diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/member-reference.c | 11 | ||||
-rw-r--r-- | clang/test/Sema/nested-redef.c | 22 | ||||
-rw-r--r-- | clang/test/SemaCXX/anonymous-union.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/class.cpp | 7 | ||||
-rw-r--r-- | clang/test/SemaObjC/duplicate-ivar-check.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/interface-scope.m | 12 | ||||
-rw-r--r-- | clang/test/SemaObjC/ivar-sem-check-1.m | 2 |
7 files changed, 55 insertions, 5 deletions
diff --git a/clang/test/Sema/member-reference.c b/clang/test/Sema/member-reference.c index 784d60020ad..b434f5b7793 100644 --- a/clang/test/Sema/member-reference.c +++ b/clang/test/Sema/member-reference.c @@ -7,3 +7,14 @@ void f(void) { s->i = 1; } +typedef int x; +struct S { + int x; + x z; +}; + +void g(void) { + struct S s[1]; + s->x = 1; + s->z = 2; +} diff --git a/clang/test/Sema/nested-redef.c b/clang/test/Sema/nested-redef.c new file mode 100644 index 00000000000..83cd4209675 --- /dev/null +++ b/clang/test/Sema/nested-redef.c @@ -0,0 +1,22 @@ +// RUN: clang -fsyntax-only -verify %s +struct X { // expected-note{{previous definition is here}} + struct X { } x; // expected-error{{nested redefinition of 'X'}} +}; + +struct Y { }; +void f(void) { + struct Y { }; // okay: this is a different Y +} + +struct T; +struct Z { + struct T { int x; } t; + struct U { int x; } u; +}; + +void f2(void) { + struct T t; + // FIXME: this is well-formed, but Clang breaks on it struct U u; +} + + diff --git a/clang/test/SemaCXX/anonymous-union.cpp b/clang/test/SemaCXX/anonymous-union.cpp index a66745b3784..872c45c4689 100644 --- a/clang/test/SemaCXX/anonymous-union.cpp +++ b/clang/test/SemaCXX/anonymous-union.cpp @@ -66,7 +66,7 @@ struct Redecl { union { int x; // expected-error{{member of anonymous union redeclares 'x'}} float y; - double z; // expected-note{{previous definition is here}} + double z; // expected-note{{previous declaration is here}} double zz; // expected-note{{previous definition is here}} }; diff --git a/clang/test/SemaCXX/class.cpp b/clang/test/SemaCXX/class.cpp index 7e06415a09d..d739af87dd7 100644 --- a/clang/test/SemaCXX/class.cpp +++ b/clang/test/SemaCXX/class.cpp @@ -53,7 +53,7 @@ public: typedef int A; - virtual int vi; // expected-error {{error: 'virtual' can only appear on non-static member functions}} + virtual int viv; // expected-error {{error: 'virtual' can only appear on non-static member functions}} virtual static int vsif(); // expected-error {{error: 'virtual' can only appear on non-static member functions}} virtual int vif(); @@ -105,3 +105,8 @@ void ogfn() struct C4; C4; // expected-error {{declaration does not declare anything}} } + +struct C4 { + void f(); // expected-note{{previous declaration is here}} + int f; // expected-error{{duplicate member 'f'}} +}; diff --git a/clang/test/SemaObjC/duplicate-ivar-check.m b/clang/test/SemaObjC/duplicate-ivar-check.m index ea42e9e277b..6dcdc38dc30 100644 --- a/clang/test/SemaObjC/duplicate-ivar-check.m +++ b/clang/test/SemaObjC/duplicate-ivar-check.m @@ -2,13 +2,13 @@ @interface B1 { @public - double fill_B; // expected-note {{previous definition is here}} + double fill_B; // expected-note {{previous declaration is here}} } @end @interface B : B1 { @public - int one; // expected-note {{previous definition is here}} + int one; // expected-note {{previous declaration is here}} int one; // expected-error {{duplicate member 'one'}} } @end diff --git a/clang/test/SemaObjC/interface-scope.m b/clang/test/SemaObjC/interface-scope.m new file mode 100644 index 00000000000..8f164a9f736 --- /dev/null +++ b/clang/test/SemaObjC/interface-scope.m @@ -0,0 +1,12 @@ +// RUN: clang -fsyntax-only -verify %s + +@interface I1 { +@private + int x; + struct { + unsigned int x : 3; + unsigned int y : 3; + } flags; + int y; +} +@end diff --git a/clang/test/SemaObjC/ivar-sem-check-1.m b/clang/test/SemaObjC/ivar-sem-check-1.m index 3416b31112a..a6d1a22a915 100644 --- a/clang/test/SemaObjC/ivar-sem-check-1.m +++ b/clang/test/SemaObjC/ivar-sem-check-1.m @@ -12,7 +12,7 @@ typedef int FOO(); struct T {} X; // expected-error {{nested redefinition of 'T'}} }YYY; FOO BADFUNC; // expected-error {{field 'BADFUNC' declared as a function}} - int kaka; // expected-note {{previous definition is here}} + int kaka; // expected-note {{previous declaration is here}} int kaka; // expected-error {{duplicate member 'kaka'}} char ch[]; // expected-error {{field 'ch' has incomplete type}} } |