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 | 621ba4f0dba0accdf67fb38e98bbe14db22ddf8e (patch) | |
tree | 93e43356c8293ce353791c1a6bd3f6be53075bc1 /test/SemaCXX/constructor-initializer.cpp | |
parent | 931c0833811c030884fa50b2ccbd3c34f0f4c4ee (diff) |
Teach the uninitialized field warning about anonymous structs and union members.
Fixes PR14073!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/constructor-initializer.cpp')
-rw-r--r-- | test/SemaCXX/constructor-initializer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp index ecbe7bf5b9..c54956db41 100644 --- a/test/SemaCXX/constructor-initializer.cpp +++ b/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}} +} |