diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp | 60 | ||||
-rw-r--r-- | clang/test/CXX/class.access/class.friend/p1.cpp | 7 | ||||
-rw-r--r-- | clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp | 4 | ||||
-rw-r--r-- | clang/test/SemaCXX/constructor-initializer.cpp | 7 | ||||
-rw-r--r-- | clang/test/SemaCXX/typedef-redecl.cpp | 2 |
5 files changed, 77 insertions, 3 deletions
diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp new file mode 100644 index 00000000000..004d1e491f1 --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp @@ -0,0 +1,60 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +namespace test0 { + struct A { + static int foo; + }; + + namespace i0 { + typedef int A; // expected-note {{declared here}} + + int test() { + struct A a; // expected-error {{elaborated type refers to a typedef}} + return a.foo; + } + } + + namespace i1 { + template <class> class A; // expected-note {{declared here}} + + int test() { + struct A a; // expected-error {{elaborated type refers to a template}} + return a.foo; + } + } + + namespace i2 { + int A; + + int test() { + struct A a; + return a.foo; + } + } + + namespace i3 { + void A(); + + int test() { + struct A a; + return a.foo; + } + } + + namespace i4 { + template <class T> void A(); + + int test() { + struct A a; + return a.foo; + } + } + + // This should magically be okay; see comment in SemaDecl.cpp. + // rdar://problem/7898108 + typedef struct A A; + int test() { + struct A a; + return a.foo; + } +} diff --git a/clang/test/CXX/class.access/class.friend/p1.cpp b/clang/test/CXX/class.access/class.friend/p1.cpp index 91d7661be3f..991698d5dcc 100644 --- a/clang/test/CXX/class.access/class.friend/p1.cpp +++ b/clang/test/CXX/class.access/class.friend/p1.cpp @@ -280,3 +280,10 @@ namespace test8 { } template A::I g2<A::I>(A::I i); } + +// PR6885 +namespace test9 { + class B { + friend class test9; + }; +} diff --git a/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp index 7604a23edb0..073b2a14635 100644 --- a/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp +++ b/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp @@ -155,7 +155,7 @@ namespace Dependent { } namespace test7 { - template <class T> class A { // expected-note {{previous definition is here}} + template <class T> class A { // expected-note {{declared here}} friend class B; int x; // expected-note {{declared private here}} }; @@ -174,7 +174,7 @@ namespace test7 { // This shouldn't crash. template <class T> class D { - friend class A; // expected-error {{redefinition of 'A' as different kind of symbol}} + friend class A; // expected-error {{elaborated type refers to a template}} }; template class D<int>; } diff --git a/clang/test/SemaCXX/constructor-initializer.cpp b/clang/test/SemaCXX/constructor-initializer.cpp index e256d9f0b30..ff963a9bce2 100644 --- a/clang/test/SemaCXX/constructor-initializer.cpp +++ b/clang/test/SemaCXX/constructor-initializer.cpp @@ -182,3 +182,10 @@ struct B { }; } + +namespace test1 { + struct A { + enum Kind { Foo } Kind; + A() : Kind(Foo) {} + }; +} diff --git a/clang/test/SemaCXX/typedef-redecl.cpp b/clang/test/SemaCXX/typedef-redecl.cpp index c382539e05f..2acf6757fa3 100644 --- a/clang/test/SemaCXX/typedef-redecl.cpp +++ b/clang/test/SemaCXX/typedef-redecl.cpp @@ -13,7 +13,7 @@ struct X { struct Y; // expected-note{{previous definition is here}} typedef int Y; // expected-error{{typedef redefinition with different types ('int' vs 'Y')}} -typedef int Y2; // expected-note{{previous definition is here}} +typedef int Y2; // expected-note{{declared here}} struct Y2; // expected-error{{definition of type 'Y2' conflicts with typedef of the same name}} void f(); // expected-note{{previous definition is here}} |