diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-02-29 00:00:28 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-02-29 00:00:28 +0000 |
commit | c60ccf5b4fb657ca40da3019c2bbe15dd8ab9732 (patch) | |
tree | bf8febe982ad17be7edd5d8c40a7180fd96702d2 /test/SemaCXX/cxx0x-initializer-aggregates.cpp | |
parent | f76b897c8ff23cef3b7b9dd12e5778b508b002ca (diff) |
Make sure list-initialization of arrays works correctly in explicit type conversions. PR12121.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-aggregates.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-aggregates.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/test/SemaCXX/cxx0x-initializer-aggregates.cpp index 48888d0eb0..801a82f570 100644 --- a/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -73,3 +73,17 @@ namespace aggregate { struct C { int a[2]; C():a({1, 2}) { } }; // expected-error {{parenthesized initialization of a member array is a GNU extension}} } + +namespace array_explicit_conversion { + typedef int test1[2]; + typedef int test2[]; + template<int x> struct A { int a[x]; }; // expected-error {{'a' declared as an array with a negative size}} + typedef A<1> test3[]; + typedef A<-1> test4[]; + void f() { + (void)test1{1}; + (void)test2{1}; + (void)test3{{{1}}}; + (void)test4{{{1}}}; // expected-note {{in instantiation of template class 'array_explicit_conversion::A<-1>' requested here}} + } +} |