diff options
author | Alexis Hunt <alercah@gmail.com> | 2011-05-20 21:43:47 +0000 |
---|---|---|
committer | Alexis Hunt <alercah@gmail.com> | 2011-05-20 21:43:47 +0000 |
commit | a671bca618cbc1ec452a3d4e8c08391ae13fc97a (patch) | |
tree | 4d20c23d5b6f93bcdc89439452e9c7e4bd205763 | |
parent | 7c619f174ac545085b1f079602d01b0472fa53b9 (diff) | |
download | bcm5719-llvm-a671bca618cbc1ec452a3d4e8c08391ae13fc97a.tar.gz bcm5719-llvm-a671bca618cbc1ec452a3d4e8c08391ae13fc97a.zip |
Add a missing case for default constructor deletion.
This case is tested by the fact that the modified test produces
significatly worse diagnostics. That's on the list.
llvm-svn: 131759
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 5 | ||||
-rw-r--r-- | clang/test/SemaCXX/value-initialization.cpp | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 90c840ba7fa..4fc9bf1fdd5 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -3433,6 +3433,11 @@ bool Sema::ShouldDeleteDefaultConstructor(CXXConstructorDecl *CD) { // This is technically non-conformant, but sanity demands it. continue; } + } else if (!Union && FieldType.isConstQualified()) { + // -- any non-variant non-static data member of const-qualified type (or + // array thereof) with no brace-or-equal-initializer does not have a + // user-provided default constructor + return true; } InitializedEntity MemberEntity = diff --git a/clang/test/SemaCXX/value-initialization.cpp b/clang/test/SemaCXX/value-initialization.cpp index 10520fb8bba..dfe0f46ea25 100644 --- a/clang/test/SemaCXX/value-initialization.cpp +++ b/clang/test/SemaCXX/value-initialization.cpp @@ -1,12 +1,11 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x -struct A { // expected-error {{implicit default constructor for 'A' must explicitly initialize the const member 'i'}} \ - // expected-warning{{struct 'A' does not declare any constructor to initialize its non-modifiable members}} - const int i; // expected-note {{declared here}} \ - // expected-note{{const member 'i' will never be initialized}} +struct A { //expected-note {{marked deleted here}} \ + // expected-warning {{does not declare any constructor to initialize}} + const int i; // expected-note{{const member 'i' will never be initialized}} virtual void f() { } }; int main () { - (void)A(); // expected-note {{first required here}} + (void)A(); // expected-error {{call to deleted constructor}} } |