diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
| commit | 56d91b49b13fe55c918afbda19f6165b5fbff87a (patch) | |
| tree | 9abb1a658a297776086f4e0dfa6ca533de02104e /test/SemaCXX/cxx0x-initializer-aggregates.cpp | |
| parent | 41e20f564abdb05101d6b2b29c59459a966c22cc (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-aggregates.cpp')
| -rw-r--r-- | test/SemaCXX/cxx0x-initializer-aggregates.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/test/SemaCXX/cxx0x-initializer-aggregates.cpp index 801a82f57065..c83058a5e196 100644 --- a/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -87,3 +87,32 @@ namespace array_explicit_conversion { (void)test4{{{1}}}; // expected-note {{in instantiation of template class 'array_explicit_conversion::A<-1>' requested here}} } } + +namespace sub_constructor { + struct DefaultConstructor { // expected-note 2 {{not viable}} + DefaultConstructor(); // expected-note {{not viable}} + int x; + }; + struct NoDefaultConstructor1 { // expected-note 2 {{not viable}} + NoDefaultConstructor1(int); // expected-note {{not viable}} + int x; + }; + struct NoDefaultConstructor2 { // expected-note 4 {{not viable}} + NoDefaultConstructor2(int,int); // expected-note 2 {{not viable}} + int x; + }; + + struct Aggr { + DefaultConstructor a; + NoDefaultConstructor1 b; + NoDefaultConstructor2 c; + }; + + Aggr ok1 { {}, {0} , {0,0} }; + Aggr ok2 = { {}, {0} , {0,0} }; + Aggr too_many { {0} , {0} , {0,0} }; // expected-error {{no matching constructor for initialization}} + Aggr too_few { {} , {0} , {0} }; // expected-error {{no matching constructor for initialization}} + Aggr invalid { {} , {&ok1} , {0,0} }; // expected-error {{no matching constructor for initialization}} + NoDefaultConstructor2 array_ok[] = { {0,0} , {0,1} }; + NoDefaultConstructor2 array_error[] = { {0,0} , {0} }; // expected-error {{no matching constructor for initialization}} +}
\ No newline at end of file |
