diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-11-01 15:53:09 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-11-01 15:53:09 +0000 |
commit | 72ef7bc2b580fae96eff0e918954c21cec32ad41 (patch) | |
tree | 73c8787922564c7525292718a4ad425c4e191636 /clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp | |
parent | 56ce0932db5a8ef8002287779c1ca8f55313a9d3 (diff) | |
download | bcm5719-llvm-72ef7bc2b580fae96eff0e918954c21cec32ad41.tar.gz bcm5719-llvm-72ef7bc2b580fae96eff0e918954c21cec32ad41.zip |
Enable function call and some overload resolution with parameters of aggregate class type and initializer list arguments.
llvm-svn: 143462
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp')
-rw-r--r-- | clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp index 687d27246c8..d8b79deb62a 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +struct one { char c[1]; }; +struct two { char c[2]; }; + namespace aggregate { // Direct list initialization does NOT allow braces to be elided! struct S { @@ -16,11 +19,41 @@ namespace aggregate { } v; }; - void test() { + void bracing() { S s1 = { 1, 2, 3 ,4, 5, 6, 7, 8 }; // no-error S s2{ {1, 2}, {3, 4}, { {5}, {6} }, { {7, 8} } }; // completely braced S s3{ 1, 2, 3, 4, 5, 6 }; // expected-error 5 {{cannot omit braces}} S s4{ {1, 2}, {3, 4}, {5, 6}, { {7, 8} } }; // expected-error 2 {{cannot omit braces}} S s5{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; // expected-error {{cannot omit braces}} } + + struct String { + String(const char*); + }; + + struct A { + int m1; + int m2; + }; + + void function_call() { + void takes_A(A); + takes_A({1, 2}); + } + + struct B { + int m1; + String m2; + }; + + void overloaded_call() { + one overloaded(A); + two overloaded(B); + + static_assert(sizeof(overloaded({1, 2})) == sizeof(one), "bad overload"); + static_assert(sizeof(overloaded({1, "two"})) == sizeof(two), + "bad overload"); + // String is not default-constructible + static_assert(sizeof(overloaded({1})) == sizeof(one), "bad overload"); + } } |