diff options
| author | Francois Pichet <pichet2000@gmail.com> | 2010-11-23 06:07:27 +0000 |
|---|---|---|
| committer | Francois Pichet <pichet2000@gmail.com> | 2010-11-23 06:07:27 +0000 |
| commit | 0c71f6c5d3a197240b53f92f161055077861a2e6 (patch) | |
| tree | fc0c0bcd72592e2e088391ed582e3d4ca3a363b1 /clang/test/Sema/MicrosoftExtensions.c | |
| parent | 6e13aa1d3baf35190642810372f1055cc121178f (diff) | |
| download | bcm5719-llvm-0c71f6c5d3a197240b53f92f161055077861a2e6.tar.gz bcm5719-llvm-0c71f6c5d3a197240b53f92f161055077861a2e6.zip | |
Microsoft C anonymous struct implementation.
Documentation: http://msdn.microsoft.com/en-us/library/z2cx9y4f.aspx
llvm-svn: 120000
Diffstat (limited to 'clang/test/Sema/MicrosoftExtensions.c')
| -rw-r--r-- | clang/test/Sema/MicrosoftExtensions.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/clang/test/Sema/MicrosoftExtensions.c b/clang/test/Sema/MicrosoftExtensions.c index 47071a383d6..0ef72855684 100644 --- a/clang/test/Sema/MicrosoftExtensions.c +++ b/clang/test/Sema/MicrosoftExtensions.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions +// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions struct A @@ -27,7 +27,43 @@ enum ENUM1* var2 = 0; enum ENUM2 { - ENUM2_a = (enum ENUM2) 4, - ENUM2_b = 0x9FFFFFFF, // expected-warning {{enumerator value is not representable in the underlying type 'int'}} - ENUM2_c = 0x100000000 // expected-warning {{enumerator value is not representable in the underlying type 'int'}} + ENUM2_a = (enum ENUM2) 4, + ENUM2_b = 0x9FFFFFFF, // expected-warning {{enumerator value is not representable in the underlying type 'int'}} + ENUM2_c = 0x100000000 // expected-warning {{enumerator value is not representable in the underlying type 'int'}} }; + + + + +typedef struct notnested { + long bad1; + long bad2; +} NOTNESTED; + + +typedef struct nested1 { + long a; + struct notnested var1; + NOTNESTED var2; +} NESTED1; + +struct nested2 { + long b; + NESTED1; // expected-warning {{anonymous structs are a Microsoft extension}} +}; + +struct test { + int c; + struct nested2; // expected-warning {{anonymous structs are a Microsoft extension}} +}; + +void foo() +{ + struct test var; + var.a; + var.b; + var.c; + var.bad1; // expected-error {{no member named 'bad1' in 'struct test'}} + var.bad2; // expected-error {{no member named 'bad2' in 'struct test'}} +} + |

