diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-07-14 19:08:10 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-07-14 19:08:10 +0000 |
commit | 9c61809c2369d78ddf118295229b69cf8bef050f (patch) | |
tree | dc5bedc417d8fe2a1029506ce0626cde42597558 /clang/test/SemaCXX/aggregate-initialization.cpp | |
parent | 771ee369660e932f31338adbb445c9de70dbf830 (diff) | |
download | bcm5719-llvm-9c61809c2369d78ddf118295229b69cf8bef050f.tar.gz bcm5719-llvm-9c61809c2369d78ddf118295229b69cf8bef050f.zip |
For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either.
This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate
test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists
in C++11 mode.
llvm-svn: 135177
Diffstat (limited to 'clang/test/SemaCXX/aggregate-initialization.cpp')
-rw-r--r-- | clang/test/SemaCXX/aggregate-initialization.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/test/SemaCXX/aggregate-initialization.cpp b/clang/test/SemaCXX/aggregate-initialization.cpp index b9e69b00b7f..d4896918982 100644 --- a/clang/test/SemaCXX/aggregate-initialization.cpp +++ b/clang/test/SemaCXX/aggregate-initialization.cpp @@ -1,9 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Verify that we can't initialize non-aggregates with an initializer // list. -// FIXME: Note that due to a (likely) standard bug, this is technically an -// aggregate. struct NonAggr1 { NonAggr1(int) { } @@ -24,7 +22,7 @@ struct NonAggr4 { virtual void f(); }; -NonAggr1 na1 = { 17 }; +NonAggr1 na1 = { 17 }; // expected-error{{non-aggregate type 'NonAggr1' cannot be initialized with an initializer list}} NonAggr2 na2 = { 17 }; // expected-error{{non-aggregate type 'NonAggr2' cannot be initialized with an initializer list}} NonAggr3 na3 = { 17 }; // expected-error{{non-aggregate type 'NonAggr3' cannot be initialized with an initializer list}} NonAggr4 na4 = { 17 }; // expected-error{{non-aggregate type 'NonAggr4' cannot be initialized with an initializer list}} @@ -48,8 +46,9 @@ struct A { A(); A(int); ~A(); - - A(const A&) = delete; // expected-note 2 {{function has been explicitly marked deleted here}} + +private: + A(const A&) {} // expected-note 4 {{declared private here}} }; struct B { @@ -62,10 +61,10 @@ struct C { void f() { A as1[1] = { }; - A as2[1] = { 1 }; // expected-error {{copying array element of type 'A' invokes deleted constructor}} + A as2[1] = { 1 }; // expected-error {{calling a private constructor of class 'A'}} expected-warning {{requires an accessible copy constructor}} B b1 = { }; - B b2 = { 1 }; // expected-error {{copying member subobject of type 'A' invokes deleted constructor}} + B b2 = { 1 }; // expected-error {{field of type 'A' has private copy constructor}} expected-warning {{requires an accessible copy constructor}} C c1 = { 1 }; } |