summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/constructor-initializer.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-06-30 02:59:29 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-06-30 02:59:29 +0000
commit139e96216a02a333cd2f26555fce028333444150 (patch)
treefce407ae32438481e8357ac15a0d08684da0b3b7 /clang/test/SemaCXX/constructor-initializer.cpp
parentbe792feb8b43485e02fd97de14e223b0faf7a247 (diff)
downloadbcm5719-llvm-139e96216a02a333cd2f26555fce028333444150.tar.gz
bcm5719-llvm-139e96216a02a333cd2f26555fce028333444150.zip
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. llvm-svn: 107242
Diffstat (limited to 'clang/test/SemaCXX/constructor-initializer.cpp')
-rw-r--r--clang/test/SemaCXX/constructor-initializer.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constructor-initializer.cpp b/clang/test/SemaCXX/constructor-initializer.cpp
index 8e9e133d94c..cf309f5597d 100644
--- a/clang/test/SemaCXX/constructor-initializer.cpp
+++ b/clang/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);
+ }
+}
OpenPOWER on IntegriCloud