Fariborz Jahanian | 6c813e1 | 2009-10-27 16:51:19 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -fsyntax-only -verify %s -std=c++0x |
| 2 | |
| 3 | struct A { |
| 4 | ~A(); |
| 5 | const int i; // expected-note {{declared at}} |
| 6 | }; |
| 7 | |
| 8 | struct B { |
| 9 | // B is a non-POD with no user-written constructor. |
| 10 | // It has a nontrivial generated constructor. |
| 11 | const int i[12]; // expected-note {{declared at}} |
| 12 | A a; |
| 13 | }; |
| 14 | |
| 15 | int main () { |
| 16 | // Value-initializing a "B" doesn't call the default constructor for |
| 17 | // "B"; it value-initializes the members of B. Therefore it shouldn't |
| 18 | // cause an error on generation of the default constructor for the |
| 19 | // following: |
| 20 | new B(); // expected-error {{cannot define the implicit default constructor for 'struct B', because const member 'i'}} |
| 21 | (void)B(); |
| 22 | (void)A(); // expected-error {{cannot define the implicit default constructor for 'struct A', because const member 'i'}} |
| 23 | } |