diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-01 02:59:17 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-01 02:59:17 +0000 |
commit | 5e4e58b805e0e03a669aa517d1d20d4735a3192e (patch) | |
tree | 48516597e0264269d5ffac1f90be4f2a1a10ca35 /test/CXX/expr | |
parent | 1d9f4c16ad9ece766870752c0647187e0b5481ba (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151794 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr')
-rw-r--r-- | test/CXX/expr/expr.ass/p9-cxx11.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/CXX/expr/expr.ass/p9-cxx11.cpp b/test/CXX/expr/expr.ass/p9-cxx11.cpp index bd1603d6ab..206c82c985 100644 --- a/test/CXX/expr/expr.ass/p9-cxx11.cpp +++ b/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 '+'}} |