summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2012-02-12 16:37:36 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2012-02-12 16:37:36 +0000
commit0501c63609a567b89289f3412e5d0225f239d7ea (patch)
tree5afa8d22290a433235c3e94729458a6cd80e35af /clang/test
parent5a41f68fe2adb7cbd7b4fdbb52c7bd496cd83116 (diff)
downloadbcm5719-llvm-0501c63609a567b89289f3412e5d0225f239d7ea.tar.gz
bcm5719-llvm-0501c63609a567b89289f3412e5d0225f239d7ea.zip
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.
llvm-svn: 150343
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp2
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-references.cpp5
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-scalars.cpp5
-rw-r--r--clang/test/SemaCXX/generalized-initializers.cpp52
4 files changed, 12 insertions, 52 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp
index d8b79deb62a..b716d81834f 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp
+++ b/clang/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/clang/test/SemaCXX/cxx0x-initializer-references.cpp b/clang/test/SemaCXX/cxx0x-initializer-references.cpp
index f84f1be7d51..fb962641de8 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-references.cpp
+++ b/clang/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/clang/test/SemaCXX/cxx0x-initializer-scalars.cpp b/clang/test/SemaCXX/cxx0x-initializer-scalars.cpp
index e0843c2246d..7d2b5b3ab9f 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-scalars.cpp
+++ b/clang/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/clang/test/SemaCXX/generalized-initializers.cpp b/clang/test/SemaCXX/generalized-initializers.cpp
deleted file mode 100644
index 1228d300d14..00000000000
--- a/clang/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 {{}}
-
-}
OpenPOWER on IntegriCloud