diff options
author | Erich Keane <ekeane@nvidia.com> | 2024-01-24 07:11:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 07:11:33 -0800 |
commit | 7d1982f62bfc9ec897d8dc8837100c6c2f2de156 (patch) | |
tree | 9307b92512e984bca262fb76436439ada0fa64ee /clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp | |
parent | aaa93ce7323332d8290b8f563d4d71689c1094c5 (diff) | |
download | llvm-revert-78041-p1907r1.zip llvm-revert-78041-p1907r1.tar.gz llvm-revert-78041-p1907r1.tar.bz2 |
Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type."revert-78041-p1907r1
Diffstat (limited to 'clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp')
-rw-r--r-- | clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp index b5b8cad..e345a1f 100644 --- a/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp +++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp @@ -8,8 +8,8 @@ namespace std { // floating-point arguments template<float> struct Float {}; -using F1 = Float<1.0f>; -using F1 = Float<2.0f / 2>; +using F1 = Float<1.0f>; // FIXME expected-error {{non-type template argument of type}} +using F1 = Float<2.0f / 2>; // FIXME expected-error {{non-type template argument of type}} struct S { int n[3]; } s; // expected-note 1+{{here}} union U { int a, b; } u; @@ -17,28 +17,24 @@ int n; // expected-note 1+{{here}} // pointers to subobjects template<int *> struct IntPtr {}; -using IPn = IntPtr<&n + 1>; -using IPn = IntPtr<&n + 1>; +using IPn = IntPtr<&n + 1>; // FIXME expected-error {{refers to subobject}} +using IPn = IntPtr<&n + 1>; // FIXME expected-error {{refers to subobject}} -using IPn2 = IntPtr<&n + 2>; // expected-error {{not a constant expression}} expected-note {{cannot refer to element 2 of non-array object}} +using IP2 = IntPtr<&s.n[2]>; // FIXME expected-error {{refers to subobject}} +using IP2 = IntPtr<s.n + 2>; // FIXME expected-error {{refers to subobject}} -using IP2 = IntPtr<&s.n[2]>; -using IP2 = IntPtr<s.n + 2>; - -using IP3 = IntPtr<&s.n[3]>; -using IP3 = IntPtr<s.n + 3>; - -using IP5 = IntPtr<&s.n[5]>; // expected-error {{not a constant expression}} expected-note {{cannot refer to element 5 of array of 3 elements}} +using IP3 = IntPtr<&s.n[3]>; // FIXME expected-error {{refers to subobject}} +using IP3 = IntPtr<s.n + 3>; // FIXME expected-error {{refers to subobject}} template<int &> struct IntRef {}; -using IRn = IntRef<*(&n + 1)>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of 'n'}} -using IRn = IntRef<*(&n + 1)>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of 'n'}} +using IPn = IntRef<*(&n + 1)>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of 'n'}} +using IPn = IntRef<*(&n + 1)>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of 'n'}} -using IR2 = IntRef<s.n[2]>; -using IR2 = IntRef<*(s.n + 2)>; +using IP2 = IntRef<s.n[2]>; // FIXME expected-error {{refers to subobject}} +using IP2 = IntRef<*(s.n + 2)>; // FIXME expected-error {{refers to subobject}} -using IR3 = IntRef<s.n[3]>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of subobject of 's'}} -using IR3 = IntRef<*(s.n + 3)>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of subobject of 's'}} +using IP3 = IntRef<s.n[3]>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of subobject of 's'}} +using IP3 = IntRef<*(s.n + 3)>; // expected-error {{not a constant expression}} expected-note {{dereferenced pointer past the end of subobject of 's'}} // classes template<S> struct Struct {}; @@ -52,12 +48,12 @@ using U1 = Union<U{.b = 1}>; // expected-error {{different types}} // miscellaneous scalar types template<_Complex int> struct ComplexInt {}; -using CI = ComplexInt<1 + 3i>; -using CI = ComplexInt<3i + 1>; +using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{non-type template argument of type}} +using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{non-type template argument of type}} template<_Complex float> struct ComplexFloat {}; -using CF = ComplexFloat<1.0f + 3.0fi>; -using CF = ComplexFloat<3.0fi + 1.0f>; +using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{non-type template argument of type}} +using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{non-type template argument of type}} namespace ClassNTTP { struct A { // expected-note 2{{candidate}} |