diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-11-15 08:19:20 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-11-15 08:19:20 +0000 |
commit | c363afb19e31c37cbcb7222738a1ede243f20602 (patch) | |
tree | 85df643d7c36a77a07e9a951cc98dc355adbd96d /clang/test/SemaCXX/constructor-initializer.cpp | |
parent | 323f614cd12fb70d151ce98db8fb9e2fec4bfdf2 (diff) | |
download | bcm5719-llvm-c363afb19e31c37cbcb7222738a1ede243f20602.tar.gz bcm5719-llvm-c363afb19e31c37cbcb7222738a1ede243f20602.zip |
Teach the uninitialized field warning about anonymous structs and union members.
Fixes PR14073!
llvm-svn: 168031
Diffstat (limited to 'clang/test/SemaCXX/constructor-initializer.cpp')
-rw-r--r-- | clang/test/SemaCXX/constructor-initializer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constructor-initializer.cpp b/clang/test/SemaCXX/constructor-initializer.cpp index ecbe7bf5b9e..c54956db418 100644 --- a/clang/test/SemaCXX/constructor-initializer.cpp +++ b/clang/test/SemaCXX/constructor-initializer.cpp @@ -283,3 +283,9 @@ namespace PR12049 { int member; // expected-error {{expected ')'}} }; } + +namespace PR14073 { + struct S1 { union { int n; }; S1() : n(n) {} }; // expected-warning {{field 'n' is uninitialized when used here}} + struct S2 { union { union { int n; }; char c; }; S2() : n(n) {} }; // expected-warning {{field 'n' is uninitialized when used here}} + struct S3 { struct { int n; }; S3() : n(n) {} }; // expected-warning {{field 'n' is uninitialized when used here}} +} |