diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
commit | 7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch) | |
tree | c72b9241553fc9966179aba84f90f17bfa9235c3 /test/SemaTemplate/instantiate-c99.cpp | |
parent | b52119637f743680a99710ce5fdb6646da2772af (diff) |
Notes
Diffstat (limited to 'test/SemaTemplate/instantiate-c99.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-c99.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-c99.cpp b/test/SemaTemplate/instantiate-c99.cpp index ae1552887b269..07d3fc7920ab3 100644 --- a/test/SemaTemplate/instantiate-c99.cpp +++ b/test/SemaTemplate/instantiate-c99.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Test template instantiation for C99-specific features. @@ -9,8 +11,13 @@ template<typename T, typename XType, typename YType> struct DesigInit0 { void f(XType x, YType y) { T agg = { +#if __cplusplus <= 199711L .y = y, // expected-error{{does not refer}} .x = x // expected-error{{does not refer}} +#else + .y = static_cast<float>(y), // expected-error{{does not refer}} + .x = static_cast<float>(x) // expected-error{{does not refer}} +#endif }; } }; @@ -44,7 +51,11 @@ template<typename T, int Subscript1, int Subscript2, struct DesigArrayInit0 { void f(Val1 val1, Val2 val2) { T array = { +#if __cplusplus <= 199711L [Subscript1] = val1, +#else + [Subscript1] = static_cast<int>(val1), +#endif [Subscript2] = val2 // expected-error{{exceeds array bounds}} }; @@ -60,7 +71,11 @@ template<typename T, int Subscript1, int Subscript2, struct DesigArrayRangeInit0 { void f(Val1 val1) { T array = { +#if __cplusplus <= 199711L [Subscript1...Subscript2] = val1 // expected-error{{exceeds}} +#else + [Subscript1...Subscript2] = static_cast<int>(val1) // expected-error{{exceeds}} +#endif }; } }; @@ -74,7 +89,11 @@ template struct DesigArrayRangeInit0<int[8], 5, 13, float>; // expected-note{{in template<typename T, typename Arg1, typename Arg2> struct CompoundLiteral0 { T f(Arg1 a1, Arg2 a2) { +#if __cplusplus <= 199711L return (T){a1, a2}; +#else + return (T){static_cast<float>(a1), a2}; +#endif } }; |