summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.ass/p9-cxx11.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-01 02:59:17 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-01 02:59:17 +0000
commit5e0cac784a574e0d5fa9c2d1a06c23027c068918 (patch)
tree44065c13c370200915f62e8b3d14de6b45ce886d /clang/test/CXX/expr/expr.ass/p9-cxx11.cpp
parent376c485493c3d9af36a91117f5221e3eafaa6198 (diff)
downloadbcm5719-llvm-5e0cac784a574e0d5fa9c2d1a06c23027c068918.tar.gz
bcm5719-llvm-5e0cac784a574e0d5fa9c2d1a06c23027c068918.zip
Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. Also
improve the diagnostics for some attempts to use initializer lists in expressions. llvm-svn: 151794
Diffstat (limited to 'clang/test/CXX/expr/expr.ass/p9-cxx11.cpp')
-rw-r--r--clang/test/CXX/expr/expr.ass/p9-cxx11.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/test/CXX/expr/expr.ass/p9-cxx11.cpp b/clang/test/CXX/expr/expr.ass/p9-cxx11.cpp
index bd1603d6ab6..206c82c985c 100644
--- a/clang/test/CXX/expr/expr.ass/p9-cxx11.cpp
+++ b/clang/test/CXX/expr/expr.ass/p9-cxx11.cpp
@@ -13,7 +13,10 @@ void std_example() {
int a, b;
a = b = { 1 };
- a = { 1 } = b;
+ a = { 1 } = b; // expected-error {{initializer list cannot be used on the left hand side of operator '='}}
+ a = a + { 4 }; // expected-error {{initializer list cannot be used on the right hand side of operator '+'}}
+ a = { 3 } * { 4 }; // expected-error {{initializer list cannot be used on the left hand side of operator '*'}} \
+ expected-error {{initializer list cannot be used on the right hand side of operator '*'}}
}
struct S {
@@ -27,5 +30,5 @@ struct T {
static_assert((T() = {4, 9}) == 4, "");
static_assert((T() += {4, 9}) == 9, "");
-int k1 = T() = { 1, 2 } = { 3, 4 }; // expected-error {{expected ';'}}
-int k2 = T() = { 1, 2 } + 1; // expected-error {{expected ';'}}
+int k1 = T() = { 1, 2 } = { 3, 4 }; // expected-error {{initializer list cannot be used on the left hand side of operator '='}}
+int k2 = T() = { 1, 2 } + 1; // expected-error {{initializer list cannot be used on the left hand side of operator '+'}}
OpenPOWER on IntegriCloud