aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/enum.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-19 19:26:10 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-19 19:26:10 +0000
commit4ec339f43c0cae2678334850c90926bea10999c7 (patch)
tree618cd12f3da4ef770bbd1d79573b85cb4c7eda1b /test/Sema/enum.c
parentfec7c2a9d0d46f4e681d1fe0089ae590962f05f6 (diff)
Centralize error reporting of improper uses of incomplete types in the
new DiagnoseIncompleteType. It provides additional information about struct/class/union/enum types when possible, either by pointing to the forward declaration of that type or by pointing to the definition (if we're in the process of defining that type). Fixes <rdar://problem/6500531>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/enum.c')
-rw-r--r--test/Sema/enum.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index ea66c27aef..55ddb0ddd9 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -21,7 +21,9 @@ int test() {
return sizeof(enum e) ;
}
-enum gccForwardEnumExtension ve; // expected-error {{variable has incomplete type 'enum gccForwardEnumExtension'}} expected-warning{{ISO C forbids forward references to 'enum' types}}
+enum gccForwardEnumExtension ve; // expected-error {{variable has incomplete type 'enum gccForwardEnumExtension'}} \
+ // expected-warning{{ISO C forbids forward references to 'enum' types}} \
+ // expected-note{{forward declaration of 'enum gccForwardEnumExtension'}}
int test2(int i)
{
@@ -52,7 +54,7 @@ enum someenum {}; // expected-warning {{use of empty enum extension}}
// <rdar://problem/6093889>
enum e0 { // expected-note {{previous definition is here}}
- E0 = sizeof(enum e0 { E1 }) // expected-error {{nested redefinition}}
+ E0 = sizeof(enum e0 { E1 }), // expected-error {{nested redefinition}}
};
// PR3173
@@ -66,3 +68,8 @@ void foo() {
// <rdar://problem/6503878>
typedef enum { X = 0 }; // expected-warning{{typedef requires a name}}
+
+
+enum NotYetComplete { // expected-note{{definition of 'enum NotYetComplete' is not complete until the closing '}'}}
+ NYC1 = sizeof(enum NotYetComplete) // expected-error{{invalid application of 'sizeof' to an incomplete type 'enum NotYetComplete'}}
+};