diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-15 00:00:53 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-15 00:00:53 +0000 |
commit | 325e593a83b20d9bce3628aa78fda983b554814e (patch) | |
tree | 915e4d1855478062a96d3ab96e87ab8e41d62d21 /test/SemaCXX/value-initialization.cpp | |
parent | 1a8cf73a825ef35917eede448817237b5fd47b05 (diff) |
Warn about non-aggregate classes with no user-declared constructors
that have reference or const scalar members, since those members can
never be initializer or modified. Fixes <rdar://problem/7804350>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101316 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/value-initialization.cpp')
-rw-r--r-- | test/SemaCXX/value-initialization.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp index 16a7a1d0c9..00bd1aaa40 100644 --- a/test/SemaCXX/value-initialization.cpp +++ b/test/SemaCXX/value-initialization.cpp @@ -1,7 +1,9 @@ // 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'}} - const int i; // expected-note {{declared at}} +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 at}} \ + // expected-note{{const member 'i' will never be initialized}} virtual void f() { } }; |