Daniel Dunbar | 8fbe78f | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | 2be8bf4 | 2009-06-29 22:33:26 +0000 | [diff] [blame] | 2 | |
| 3 | class S { |
| 4 | public: |
| 5 | S (); |
| 6 | }; |
| 7 | |
| 8 | struct D : S { |
Anders Carlsson | 83ac312 | 2010-03-30 16:19:37 +0000 | [diff] [blame^] | 9 | D() : |
| 10 | b1(0), // expected-note {{previous initialization is here}} |
| 11 | b2(1), |
| 12 | b1(0), // expected-error {{multiple initializations given for non-static member 'b1'}} |
| 13 | S(), // expected-note {{previous initialization is here}} |
| 14 | S() // expected-error {{multiple initializations given for base 'S'}} |
| 15 | {} |
Fariborz Jahanian | 2be8bf4 | 2009-06-29 22:33:26 +0000 | [diff] [blame] | 16 | int b1; |
| 17 | int b2; |
Fariborz Jahanian | 2be8bf4 | 2009-06-29 22:33:26 +0000 | [diff] [blame] | 18 | }; |
| 19 | |
Anders Carlsson | 83ac312 | 2010-03-30 16:19:37 +0000 | [diff] [blame^] | 20 | struct A { |
| 21 | struct { |
| 22 | int a; |
| 23 | int b; |
| 24 | }; |
| 25 | A(); |
| 26 | }; |
Fariborz Jahanian | 2be8bf4 | 2009-06-29 22:33:26 +0000 | [diff] [blame] | 27 | |
Anders Carlsson | 83ac312 | 2010-03-30 16:19:37 +0000 | [diff] [blame^] | 28 | A::A() : a(10), b(20) { } |