diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-12 19:00:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-12 19:00:39 +0000 |
commit | dfb5e597e033c8fa09c0e178bd93cfcdf060862e (patch) | |
tree | af2fff75df5c91d48688e9665771efdfe5919e33 /test/Sema/designated-initializers.c | |
parent | 01a0c3624aaa976ccba08b6cee1606521b8378d2 (diff) |
Fix a bug with designated initializers where we were stepping out of a
union subobject initialization before checking whether the next
initiailizer was actually a designated initializer. This led to
spurious "excess elements in union initializer" errors. Thanks to
rdivacky for reporting the bug!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64392 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/designated-initializers.c')
-rw-r--r-- | test/Sema/designated-initializers.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Sema/designated-initializers.c b/test/Sema/designated-initializers.c index 9c4429d02d..7c6ddca8ef 100644 --- a/test/Sema/designated-initializers.c +++ b/test/Sema/designated-initializers.c @@ -172,3 +172,17 @@ struct bar saloon = { .f.arr[3] = 1, .arr = { &f } }; + +typedef unsigned char u_char; +typedef unsigned short u_short; + +union wibble { + u_char arr1[6]; + u_short arr2[3]; +}; + +const union wibble wobble = { .arr2[0] = 0xffff, + .arr2[1] = 0xffff, + .arr2[2] = 0xffff }; + +const union wibble wobble2 = { .arr2 = {4, 5, 6}, 7 }; // expected-error{{excess elements in union initializer}} |