diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-06-30 02:59:29 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-06-30 02:59:29 +0000 |
commit | e861c60bde74cf495447f50844d7ee7ea3a8a7a0 (patch) | |
tree | 8ed4e4a24f4ac69f016f8310f59d378302c6e4cc /test/SemaCXX/constructor-initializer.cpp | |
parent | ec29b352b7ab2a2e99f7a9b78ce27c5e2a08d0e1 (diff) |
Reapply r107235, this time with both my typo fixed, and a logical bug fixed.
Previously we relied on the presence of a member which needs no initialization
to prevent us from creating an additional initialization of the outer anonymous
union field. We have already correctly marked that field as initialized by the
member of the union (repeatedly due to the original bug this patch fixes) so we
simply need to bail out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107242 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/constructor-initializer.cpp')
-rw-r--r-- | test/SemaCXX/constructor-initializer.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp index 8e9e133d94..cf309f5597 100644 --- a/test/SemaCXX/constructor-initializer.cpp +++ b/test/SemaCXX/constructor-initializer.cpp @@ -204,3 +204,20 @@ C f(C c) { } } + +// Don't build implicit initializers for anonymous union fields when we already +// have an explicit initializer for another field in the union. +namespace PR7402 { + struct S { + union { + void* ptr_; + struct { int i_; }; + }; + + template <typename T> S(T) : ptr_(0) { } + }; + + void f() { + S s(3); + } +} |