summaryrefslogtreecommitdiff
path: root/test/SemaCXX/class-base-member-init.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-03-30 16:19:37 +0000
committerAnders Carlsson <andersca@mac.com>2010-03-30 16:19:37 +0000
commitee11b2dd530f3fb873e108f21341626168758a45 (patch)
treeba220c2cc2fabe8663837aa51d20736be47cb208 /test/SemaCXX/class-base-member-init.cpp
parent8f1a24071faabf5796eb7dc1b19be52dc1a2d324 (diff)
downloadclang-ee11b2dd530f3fb873e108f21341626168758a45.tar.gz
Fix a bug where we would incorrectly report an error about initializing two fields in an anonymous struct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/class-base-member-init.cpp')
-rw-r--r--test/SemaCXX/class-base-member-init.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/SemaCXX/class-base-member-init.cpp b/test/SemaCXX/class-base-member-init.cpp
index 1c6e79012e..0821c34b02 100644
--- a/test/SemaCXX/class-base-member-init.cpp
+++ b/test/SemaCXX/class-base-member-init.cpp
@@ -6,14 +6,23 @@ public:
};
struct D : S {
- D() : b1(0), b2(1), b1(0), S(), S() {} // expected-error {{multiple initializations given for non-static member 'b1'}} \
- // expected-note {{previous initialization is here}} \
- // expected-error {{multiple initializations given for base 'S'}} \
- // expected-note {{previous initialization is here}}
-
+ D() :
+ b1(0), // expected-note {{previous initialization is here}}
+ b2(1),
+ b1(0), // expected-error {{multiple initializations given for non-static member 'b1'}}
+ S(), // expected-note {{previous initialization is here}}
+ S() // expected-error {{multiple initializations given for base 'S'}}
+ {}
int b1;
int b2;
-
};
+struct A {
+ struct {
+ int a;
+ int b;
+ };
+ A();
+};
+A::A() : a(10), b(20) { }