diff options
-rw-r--r-- | clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp index 2142c098f88..4436cb0aac6 100644 --- a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp +++ b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp @@ -147,8 +147,10 @@ void int_to_float() { void shrink_int() { // Not a constant expression. short s = 1; + UnscopedEnum e = EnumVal; unsigned short us = 1; Agg<char> c1 = {s}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} + Agg<char> c2 = {e}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} Agg<unsigned short> s1 = {s}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} Agg<short> s2 = {us}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} @@ -158,16 +160,19 @@ void shrink_int() { // long). long l1 = 1; Agg<int> i1 = {l1}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} + Agg<int> i2 = {e}; // OK long long ll = 1; Agg<long> l2 = {ll}; // OK // Constants. - Agg<char> c2 = {127}; // OK - Agg<char> c3 = {300}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} expected-warning {{changes value}} - - Agg<int> i2 = {0x7FFFFFFFU}; // OK - Agg<int> i3 = {0x80000000U}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} - Agg<unsigned int> i4 = {-0x80000000L}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} + Agg<char> c3 = {127}; // OK + Agg<char> c4 = {300}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} expected-warning {{changes value}} + Agg<char> c5 = {EnumVal}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} expected-warning {{changes value}} + + Agg<int> i3 = {0x7FFFFFFFU}; // OK + Agg<int> i4 = {EnumVal}; // OK + Agg<int> i5 = {0x80000000U}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} + Agg<unsigned int> i6 = {-0x80000000L}; // expected-error {{ cannot be narrowed }} expected-note {{silence}} // Bool is also an integer type, but conversions to it are a different AST // node. |