Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Anders Carlsson | 5071345 | 2009-03-26 00:24:17 +0000 | [diff] [blame] | 2 | |
| 3 | class C { |
| 4 | struct S; // expected-note {{previously declared 'private' here}} |
Anders Carlsson | 5071345 | 2009-03-26 00:24:17 +0000 | [diff] [blame] | 5 | public: |
Anders Carlsson | 4cbe82c | 2009-03-26 01:24:28 +0000 | [diff] [blame] | 6 | |
Anders Carlsson | 5071345 | 2009-03-26 00:24:17 +0000 | [diff] [blame] | 7 | struct S {}; // expected-error {{'S' redeclared with 'public' access}} |
| 8 | }; |
| 9 | |
| 10 | struct S { |
| 11 | class C; // expected-note {{previously declared 'public' here}} |
| 12 | |
| 13 | private: |
| 14 | class C { }; // expected-error {{'C' redeclared with 'private' access}} |
Anders Carlsson | 4cbe82c | 2009-03-26 01:24:28 +0000 | [diff] [blame] | 15 | }; |
| 16 | |
| 17 | class T { |
| 18 | protected: |
| 19 | template<typename T> struct A; // expected-note {{previously declared 'protected' here}} |
| 20 | |
| 21 | private: |
| 22 | template<typename T> struct A {}; // expected-error {{'A' redeclared with 'private' access}} |
| 23 | }; |
John McCall | 44e067b | 2009-12-23 00:37:40 +0000 | [diff] [blame] | 24 | |
| 25 | // PR5573 |
| 26 | namespace test1 { |
| 27 | class A { |
| 28 | private: |
| 29 | class X; // expected-note {{previously declared 'private' here}} |
| 30 | public: |
| 31 | class X; // expected-error {{ 'X' redeclared with 'public' access}} |
| 32 | class X {}; |
| 33 | }; |
| 34 | } |