diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-06-03 08:26:00 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-06-03 08:26:00 +0000 |
commit | 454a7cdfb35e492e0539cbc75452229d3a5c5f54 (patch) | |
tree | c63fb6636b1be122d7ebe1ab777d4bfa8c722939 /clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | |
parent | f05149680450b6543fc676987f601f359a86281f (diff) | |
download | bcm5719-llvm-454a7cdfb35e492e0539cbc75452229d3a5c5f54.tar.gz bcm5719-llvm-454a7cdfb35e492e0539cbc75452229d3a5c5f54.zip |
Implement DR990 and DR1070. Aggregate initialization initializes uninitialized
elements from {}, rather than value-initializing them. This permits calling an
initializer-list constructor or constructing a std::initializer_list object.
(It would also permit initializing a const reference or rvalue reference if
that weren't explicitly prohibited by other rules.)
llvm-svn: 210091
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r-- | clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp index 9d89cce67b3..db6614de037 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -230,3 +230,11 @@ namespace PR18013 { int f(); std::initializer_list<long (*)()> x = {f}; // expected-error {{cannot initialize an array element of type 'long (*const)()' with an lvalue of type 'int ()': different return type ('long' vs 'int')}} } + +namespace DR1070 { + struct S { + S(std::initializer_list<int>); + }; + S s[3] = { {1, 2, 3}, {4, 5} }; // ok + S *p = new S[3] { {1, 2, 3}, {4, 5} }; // ok +} |