blob: 6115ff6a94f405a2d55bcfb7172f9fb110cb81c5 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Anders Carlsson50713452009-03-26 00:24:17 +00002
3class C {
4 struct S; // expected-note {{previously declared 'private' here}}
Anders Carlsson50713452009-03-26 00:24:17 +00005public:
Anders Carlsson4cbe82c2009-03-26 01:24:28 +00006
Anders Carlsson50713452009-03-26 00:24:17 +00007 struct S {}; // expected-error {{'S' redeclared with 'public' access}}
8};
9
10struct S {
11 class C; // expected-note {{previously declared 'public' here}}
12
13private:
14 class C { }; // expected-error {{'C' redeclared with 'private' access}}
Anders Carlsson4cbe82c2009-03-26 01:24:28 +000015};
16
17class T {
18protected:
19 template<typename T> struct A; // expected-note {{previously declared 'protected' here}}
20
21private:
22 template<typename T> struct A {}; // expected-error {{'A' redeclared with 'private' access}}
23};
John McCall44e067b2009-12-23 00:37:40 +000024
25// PR5573
26namespace 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}