diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-12 16:37:36 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-12 16:37:36 +0000 |
commit | 3a45c0e61dfc19f27b8ebcb15dd70159a36f1f9a (patch) | |
tree | 088c5ce0d8ef8af12947e22ae241b185a3680fad /test | |
parent | 168319c81b8f4e7addf36ad15ef24919faf23504 (diff) |
Change the way we store initialization kinds so that all direct inits can distinguish between list and parens form. This allows us to correctly diagnose the last test cases from litb.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-aggregates.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-references.cpp | 5 | ||||
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-scalars.cpp | 5 | ||||
-rw-r--r-- | test/SemaCXX/generalized-initializers.cpp | 52 |
4 files changed, 12 insertions, 52 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/test/SemaCXX/cxx0x-initializer-aggregates.cpp index d8b79deb62..b716d81834 100644 --- a/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -56,4 +56,6 @@ namespace aggregate { // String is not default-constructible static_assert(sizeof(overloaded({1})) == sizeof(one), "bad overload"); } + + struct C { int a[2]; C():a({1, 2}) { } }; // expected-error {{array initializer must be an initializer list}} } diff --git a/test/SemaCXX/cxx0x-initializer-references.cpp b/test/SemaCXX/cxx0x-initializer-references.cpp index f84f1be7d5..fb962641de 100644 --- a/test/SemaCXX/cxx0x-initializer-references.cpp +++ b/test/SemaCXX/cxx0x-initializer-references.cpp @@ -71,4 +71,9 @@ namespace reference { static_assert(sizeof(h({1, 2})) == sizeof(two), "bad overload resolution"); } + void edge_cases() { + // FIXME: very poor error message + int const &b({0}); // expected-error {{could not bind}} + } + } diff --git a/test/SemaCXX/cxx0x-initializer-scalars.cpp b/test/SemaCXX/cxx0x-initializer-scalars.cpp index e0843c2246..7d2b5b3ab9 100644 --- a/test/SemaCXX/cxx0x-initializer-scalars.cpp +++ b/test/SemaCXX/cxx0x-initializer-scalars.cpp @@ -55,4 +55,9 @@ namespace integral { emptylist({}); emptylist({}, {}, {}); } + + void edge_cases() { + // FIXME: very poor error message + int a({0}); // expected-error {{cannot initialize}} + } } diff --git a/test/SemaCXX/generalized-initializers.cpp b/test/SemaCXX/generalized-initializers.cpp deleted file mode 100644 index 1228d300d1..0000000000 --- a/test/SemaCXX/generalized-initializers.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -// XFAIL: * - -template <typename T, typename U> -struct same_type { static const bool value = false; }; -template <typename T> -struct same_type<T, T> { static const bool value = true; }; - -namespace std { - typedef decltype(sizeof(int)) size_t; - - // libc++'s implementation - template <class _E> - class initializer_list - { - const _E* __begin_; - size_t __size_; - - initializer_list(const _E* __b, size_t __s) - : __begin_(__b), - __size_(__s) - {} - - public: - typedef _E value_type; - typedef const _E& reference; - typedef const _E& const_reference; - typedef size_t size_type; - - typedef const _E* iterator; - typedef const _E* const_iterator; - - initializer_list() : __begin_(nullptr), __size_(0) {} - - size_t size() const {return __size_;} - const _E* begin() const {return __begin_;} - const _E* end() const {return __begin_ + __size_;} - }; -} - -namespace litb { - - // invalid - struct A { int a[2]; A():a({1, 2}) { } }; // expected-error {{}} - - // invalid - int a({0}); // expected-error {{}} - - // invalid - int const &b({0}); // expected-error {{}} - -} |