aboutsummaryrefslogtreecommitdiff
path: root/clang/test
diff options
context:
space:
mode:
authorErich Keane <ekeane@nvidia.com>2024-01-24 07:11:33 -0800
committerGitHub <noreply@github.com>2024-01-24 07:11:33 -0800
commit7d1982f62bfc9ec897d8dc8837100c6c2f2de156 (patch)
tree9307b92512e984bca262fb76436439ada0fa64ee /clang/test
parentaaa93ce7323332d8290b8f563d4d71689c1094c5 (diff)
downloadllvm-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')
-rw-r--r--clang/test/CXX/drs/dr18xx.cpp4
-rw-r--r--clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp4
-rw-r--r--clang/test/CodeGenCXX/mangle-ms-templates.cpp48
-rw-r--r--clang/test/CodeGenCXX/mangle-template.cpp40
-rw-r--r--clang/test/CodeGenCXX/template-arguments.cpp113
-rw-r--r--clang/test/Index/USR/structural-value-tpl-arg.cpp23
-rw-r--r--clang/test/Modules/odr_hash.cpp193
-rw-r--r--clang/test/SemaCXX/warn-bool-conversion.cpp2
-rw-r--r--clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp40
-rw-r--r--clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp40
10 files changed, 46 insertions, 461 deletions
diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp
index 37ea450..f2c056e 100644
--- a/clang/test/CXX/drs/dr18xx.cpp
+++ b/clang/test/CXX/drs/dr18xx.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,cxx98-14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,cxx11-17,since-cxx11,since-cxx14,cxx17 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
@@ -25,7 +25,7 @@ template <int &> struct S {}; // #dr1801-S
S<i> V; // #dr1801-S-i
// cxx98-14-error@-1 {{non-type template argument does not refer to any declaration}}
// cxx98-14-note@#dr1801-S {{template parameter is declared here}}
-// cxx17-error@#dr1801-S-i {{non-type template argument refers to subobject '.i'}}
+// since-cxx17-error@#dr1801-S-i {{non-type template argument refers to subobject '.i'}}
}
namespace dr1802 { // dr1802: 3.1
diff --git a/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp b/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
index 7fce615..a17720c 100644
--- a/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
+++ b/clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
@@ -200,9 +200,7 @@ namespace bad_args {
// cxx17-note@-3 {{reinterpret_cast}}
X0<__builtin_constant_p(0) ? (int*)1 : (int*)1> x0d;
// precxx17-error@-1 {{non-type template argument '(int *)1' is invalid}}
-#if __cplusplus == 201703L
- // cxx17-error@-3 {{non-type template argument refers to subobject '(int *)1'}}
-#endif
+ // cxx17-error@-2 {{non-type template argument refers to subobject '(int *)1'}}
}
#endif // CPP11ONLY
diff --git a/clang/test/CodeGenCXX/mangle-ms-templates.cpp b/clang/test/CodeGenCXX/mangle-ms-templates.cpp
index ec4250e..cefe1e0 100644
--- a/clang/test/CodeGenCXX/mangle-ms-templates.cpp
+++ b/clang/test/CodeGenCXX/mangle-ms-templates.cpp
@@ -2,21 +2,6 @@
// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
-// RUN: %clang_cc1 -std=c++20 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix CXX20-X64 %s
-
-// Check that array-to-pointer decay is mangled as the underlying declaration.
-extern const char arr[4] = "foo";
-template<const char*> struct Decay1 {};
-// CHECK: "?decay1@@3U?$Decay1@$1?arr@@3QBDB@@A"
-Decay1<arr> decay1;
-#if __cplusplus >= 201702L
-// Note that this mangling approach can lead to collisions.
-template<const void*> struct Decay2 {};
-// CXX20-X64: "?decay2a@@3U?$Decay2@$1?arr@@3QBDB@@A"
-Decay2<(const void*)arr> decay2a;
-// CXX20-X64: "?decay2b@@3U?$Decay2@$1?arr@@3QBDB@@A"
-Decay2<(const void*)&arr> decay2b;
-#endif
template<typename T>
class Class {
@@ -342,36 +327,3 @@ void fun_uint128(UInt128<(unsigned __int128)-1>) {}
// X64: define {{.*}} @"?fun_uint128@@YAXU?$UInt128@$0DPPPPPPPPPPPPPPPAAAAAAAAAAAAAAAB@@@@Z"(
void fun_uint128(UInt128<(unsigned __int128)9223372036854775807 * (unsigned __int128)9223372036854775807>) {}
#endif
-
-#if __cplusplus >= 202002L
-
-template<float> struct Float {};
-// CXX20-X64: define {{.*}} @"?f@@YAXU?$Float@$ADPIAAAAA@@@@Z"(
-void f(Float<1.0f>) {}
-template<auto> struct Auto {};
-// CXX20-X64: define {{.*}} @"?f@@YAXU?$Auto@$MMADPIAAAAA@@@@Z"(
-void f(Auto<1.0f>) {}
-
-struct S2 {
- int arr[2][3];
- int i;
- void fn();
-} s2;
-
-template<int&> struct TplSubobjectRef {};
-// CXX20-X64: define {{.*}} @"?f@@YAXU?$TplSubobjectRef@$CC61?s2@@3US2@@Aarr@@00@01@@@@Z"(
-void f(TplSubobjectRef<s2.arr[1][2]>) {}
-template<int*> struct TplSubobjectPtr {};
-// CXX20-X64: define {{.*}} @"?f@@YAXU?$TplSubobjectPtr@$CC61?s2@@3US2@@Aarr@@00@01@@@@Z"(
-void f(TplSubobjectPtr<&s2.arr[1][2]>) {}
-
-struct Derived : S2 {};
-
-template <int Derived::*> struct TplMemberPtr {};
-// CXX20-X64: define {{.*}} @"?f@@YAXU?$TplMemberPtr@$0BI@@@@Z"(
-void f(TplMemberPtr<(int Derived::*)&S2::i>) {}
-template <void (Derived::*)()> struct TplMemberFnPtr {};
-// CXX20-X64: define {{.*}} @"?f@@YAXU?$TplMemberFnPtr@$1?fn@S2@@QEAAXXZ@@@Z"(
-void f(TplMemberFnPtr<(void (Derived::*)())&S2::fn>) {}
-
-#endif
diff --git a/clang/test/CodeGenCXX/mangle-template.cpp b/clang/test/CodeGenCXX/mangle-template.cpp
index a4cb227..8415bac 100644
--- a/clang/test/CodeGenCXX/mangle-template.cpp
+++ b/clang/test/CodeGenCXX/mangle-template.cpp
@@ -225,16 +225,6 @@ namespace test16 {
namespace cxx20 {
template<auto> struct A {};
template<typename T, T V> struct B {};
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AILf3f800000EEE(
- void f(A<1.0f>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AILd3ff0000000000000EEE(
- void f(A<1.0>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AILe3fff8000000000000000EEE(
- void f(A<1.0l>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXtlCiLi0ELi1EEEEE(
- void f(A<1i>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXtlCdLd0000000000000000ELd3ff0000000000000EEEEE(
- void f(A<1.0i>) {}
int x;
// CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXadL_ZNS_1xEEEEE(
@@ -254,24 +244,7 @@ namespace cxx20 {
// CXX20: define {{.*}} @_ZN5cxx201fENS_1BIPKvXadL_ZNS_1xEEEEE(
void f(B<const void*, (const void*)&x>) {}
- struct Q { int x; } q;
-
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXadsoiL_ZNS_1qEEEEEE(
- void f(A<&q.x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1BIPiXadsoiL_ZNS_1qEEEEEE(
- void f(B<int*, &q.x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXadsoKiL_ZNS_1qEEEEEE(
- void f(A<(const int*)&q.x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1BIPKiXadsoS1_L_ZNS_1qEEEEEE
- void f(B<const int*, (const int*)&q.x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXcvPvadsoiL_ZNS_1qEEEEEE(
- void f(A<(void*)&q.x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1BIPvXadsoiL_ZNS_1qEEEEEE(
- void f(B<void*, (void*)&q.x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXcvPKvadsoiL_ZNS_1qEEEEEE(
- void f(A<(const void*)&q.x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1BIPKvXadsoiL_ZNS_1qEEEEEE(
- void f(B<const void*, (const void*)&q.x>) {}
+ struct Q { int x; };
// CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXadL_ZNS_1Q1xEEEEE(
void f(A<&Q::x>) {}
@@ -281,17 +254,6 @@ namespace cxx20 {
void f(A<(const int Q::*)&Q::x>) {}
// CXX20: define {{.*}} @_ZN5cxx201fENS_1BIMNS_1QEKiXadL_ZNS1_1xEEEEE(
void f(B<const int Q::*, (const int Q::*)&Q::x>) {}
-
- struct R : Q {};
-
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXmcMNS_1REiadL_ZNS_1Q1xEEEEEE(
- void f(A<(int R::*)&Q::x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1BIMNS_1REiXmcS2_adL_ZNS_1Q1xEEEEEE(
- void f(B<int R::*, (int R::*)&Q::x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1AIXmcMNS_1REKiadL_ZNS_1Q1xEEEEEE(
- void f(A<(const int R::*)&Q::x>) {}
- // CXX20: define {{.*}} @_ZN5cxx201fENS_1BIMNS_1REKiXmcS3_adL_ZNS_1Q1xEEEEEE(
- void f(B<const int R::*, (const int R::*)&Q::x>) {}
}
#endif
diff --git a/clang/test/CodeGenCXX/template-arguments.cpp b/clang/test/CodeGenCXX/template-arguments.cpp
deleted file mode 100644
index 14a4549..0000000
--- a/clang/test/CodeGenCXX/template-arguments.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// RUN: %clang_cc1 -std=c++20 %s -emit-llvm -o - -triple x86_64-linux -DCONSTEXPR= | FileCheck %s
-// RUN: %clang_cc1 -std=c++20 %s -emit-llvm -o - -triple x86_64-linux -DCONSTEXPR=constexpr | FileCheck %s --check-prefix=CONST
-
-template<typename T> CONSTEXPR T id(T v) { return v; }
-template<auto V> auto value = id(V);
-
-// CHECK: call {{.*}} @_Z2idIiET_S0_(i32 noundef 1)
-// CONST: @_Z5valueILi1EE = weak_odr {{.*}} i32 1,
-template int value<1>;
-
-// CHECK: call {{.*}} @_Z2idIyET_S0_(i64 noundef -1)
-// CONST: @_Z5valueILy18446744073709551615EE = weak_odr {{.*}} i64 -1,
-template unsigned long long value<-1ULL>;
-
-// CHECK: call {{.*}} @_Z2idIfET_S0_(float noundef 1.000000e+00)
-// CONST: @_Z5valueILf3f800000EE = weak_odr {{.*}} float 1.000000e+00,
-template float value<1.0f>;
-// CHECK: call {{.*}} @_Z2idIdET_S0_(double noundef 1.000000e+00)
-// CONST: @_Z5valueILd3ff0000000000000EE = weak_odr {{.*}} double 1.000000e+00,
-template double value<1.0>;
-
-enum E{ E1, E2};
-
-// CHECK: call {{.*}} @_Z2idI1EET_S1_(i32 noundef 1)
-// CONST: @_Z5valueIL1E1EE = weak_odr {{.*}} i32 1,
-template E value<E2>;
-
-int n;
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef @n)
-// CONST: @_Z5valueIXadL_Z1nEEE = weak_odr {{.*}} ptr @n,
-template int *value<&n>;
-
-struct A { int a[3]; } a;
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef @a)
-// CONST: @_Z5valueIXadsoiL_Z1aEEEE = weak_odr {{.*}} ptr @a,
-template int *value<&a.a[0]>;
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef getelementptr (i8, ptr @a, i64 4))
-// CONST: @_Z5valueIXadsoiL_Z1aE4EEE = weak_odr {{.*}} ptr getelementptr (i8, ptr @a, i64 4),
-template int *value<&a.a[1]>;
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef getelementptr (i8, ptr @a, i64 8))
-// CONST: @_Z5valueIXadsoiL_Z1aE8EEE = weak_odr {{.*}} ptr getelementptr (i8, ptr @a, i64 8),
-template int *value<&a.a[2]>;
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef getelementptr (i8, ptr @a, i64 12))
-// CONST: @_Z5valueIXadsoiL_Z1aE12pEEE = weak_odr {{.*}} ptr getelementptr (i8, ptr @a, i64 12),
-template int *value<&a.a[3]>;
-
-union U {
- int x, y;
- union {
- int x, y;
- } internal;
-} u;
-
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef @u)
-// CONST: @_Z5valueIXadsoiL_Z1uE_EEE = weak_odr {{.*}} ptr @u,
-template int *value<&u.x>;
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef @u)
-// CONST: @_Z5valueIXadsoiL_Z1uE_0EEE = weak_odr {{.*}} ptr @u,
-template int *value<&u.y>;
-// CHECK: call {{.*}} @_Z2idIPiET_S1_(ptr noundef @u)
-// CONST: @_Z5valueIXadsoiL_Z1uE_1_0EEE = weak_odr {{.*}} ptr @u,
-template int *value<&u.internal.y>;
-
-struct B { int x, y; };
-// CHECK: call {{.*}} @_Z2idIM1BiET_S2_(i64 0)
-// CONST: @_Z5valueIXadL_ZN1B1xEEEE = weak_odr {{.*}} i64 0,
-template int B::*value<&B::x>;
-// CHECK: call {{.*}} @_Z2idIM1BiET_S2_(i64 4)
-// CONST: @_Z5valueIXadL_ZN1B1yEEEE = weak_odr {{.*}} i64 4,
-template int B::*value<&B::y>;
-
-struct C : A, B { int z; };
-// CHECK: call {{.*}} @_Z2idIM1CiET_S2_(i64 12)
-// CONST: @_Z5valueIXmcM1CiadL_ZN1B1xEE12EEE = weak_odr {{.*}} i64 12,
-template int C::*value<(int C::*)&B::x>;
-// CHECK: call {{.*}} @_Z2idIM1BiET_S2_(i64 8)
-// CONST: @_Z5valueIXmcM1BiadL_ZN1C1zEEn12EEE = weak_odr {{.*}} i64 8,
-template int B::*value<(int B::*)&C::z>;
-
-// CHECK: store i32 1,
-// CHECK: store i32 2,
-// CHECK: load i64,
-// CHECK: call {{.*}} @_Z2idICiET_S1_(i64 noundef %
-// CONST: @_Z5valueIXtlCiLi1ELi2EEEE = weak_odr {{.*}} { i32, i32 } { i32 1, i32 2 },
-template _Complex int value<1 + 2j>;
-
-// CHECK: store float 1.000000e+00,
-// CHECK: store float 2.000000e+00,
-// CHECK: load <2 x float>,
-// CHECK: call {{.*}} @_Z2idICfET_S1_(<2 x float> noundef %
-// CONST: @_Z5valueIXtlCfLf3f800000ELf40000000EEEE = weak_odr {{.*}} { float, float } { float 1.000000e+00, float 2.000000e+00 },
-template _Complex float value<1.0f + 2.0fj>;
-
-using V3i __attribute__((ext_vector_type(3))) = int;
-// CHECK: call {{.*}} @_Z2idIDv3_iET_S1_(<3 x i32> noundef <i32 1, i32 2, i32 3>)
-// CONST: @_Z5valueIXtlDv3_iLi1ELi2ELi3EEEE = weak_odr {{.*}} <3 x i32> <i32 1, i32 2, i32 3>
-template V3i value<V3i{1, 2, 3}>;
-
-using V3f [[gnu::vector_size(12)]] = float;
-// CHECK: call {{.*}} @_Z2idIDv3_fET_S1_(<3 x float> noundef <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>)
-// CONST: @_Z5valueIXtlDv3_fLf3f800000ELf40000000ELf40400000EEEE = weak_odr {{.*}} <3 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>
-template V3f value<V3f{1, 2, 3}>;
-
-
-template <int& i>
-void setByRef() {
- i = 1;
-}
-
-void callSetByRefWithSubobject() {
- // CHECK: store i32 1, ptr getelementptr (i8, ptr @a, i64 4)
- setByRef<a.a[1]>();
-}
diff --git a/clang/test/Index/USR/structural-value-tpl-arg.cpp b/clang/test/Index/USR/structural-value-tpl-arg.cpp
deleted file mode 100644
index 81300124..0000000
--- a/clang/test/Index/USR/structural-value-tpl-arg.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// RUN: c-index-test -test-load-source-usrs local -std=c++20 -- %s | FileCheck %s
-
-// Check USRs of template specializations with structural NTTP values.
-
-template <auto> struct Tpl{};
-
-struct {
- int n;
-} s;
-
-void fn1(Tpl<1.5>);
-// CHECK: fn1#$@S@Tpl>#Sd[[#HASH:]]#
-void fn2(Tpl<1.7>);
-// CHECK-NOT: [[#HASH]]
-void fn1(Tpl<1.5>) {}
-// CHECK: fn1#$@S@Tpl>#Sd[[#HASH]]#
-
-void fn(Tpl<&s.n>);
-// CHECK: #S*I[[#HASH:]]#
-void fn(Tpl<(void*)&s.n>);
-// CHECK: #S*v[[#HASH]]#
-void fn(Tpl<&s.n>) {}
-// CHECK: #S*I[[#HASH]]#
diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp
index fa8b2c8..220ef76 100644
--- a/clang/test/Modules/odr_hash.cpp
+++ b/clang/test/Modules/odr_hash.cpp
@@ -13,8 +13,8 @@
// RUN: cat %s >> %t/Inputs/second.h
// Test that each header can compile
-// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++20 %t/Inputs/first.h
-// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++20 %t/Inputs/second.h
+// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++1z %t/Inputs/first.h
+// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++1z %t/Inputs/second.h
// Build module map file
// RUN: echo "module FirstModule {" >> %t/Inputs/module.modulemap
@@ -25,7 +25,7 @@
// RUN: echo "}" >> %t/Inputs/module.modulemap
// Run test
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -x c++ -std=c++20 \
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -x c++ -std=c++1z \
// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache \
// RUN: -I%t/Inputs -verify %s
@@ -2093,193 +2093,6 @@ struct S21 {
S21 s21;
#endif
-#if defined(FIRST)
-struct S22 {
- template <double> void f(){};
- template <> void f<1.5>(){};
-};
-#elif defined(SECOND)
-struct S22 {
- template <double> void f(){};
- template <> void f<1.7>(){};
-};
-#else
-S22 s22;
-// expected-error@second.h:* {{'TemplateArgument::S22' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'f' with 1.700000e+00 for 1st template argument}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'f' with 1.500000e+00 for 1st template argument}}
-#endif
-
-#if defined(FIRST)
-struct S23 {
- template <double> void f(){};
- template <> void f<2.7>(){};
-};
-#elif defined(SECOND)
-struct S23 {
- template <double> void f(){};
- template <> void f<2.7>(){};
-};
-#else
-S23 s23;
-#endif
-
-#if defined(FIRST) || defined(SECOND)
-struct Composite {
- int n1[4];
- int n2[4];
-};
-extern Composite composite;
-#endif
-
-#if defined(FIRST)
-struct S24 {
- template <int&> void f(){};
- template <> void f<composite.n1[1]>(){};
-};
-#elif defined(SECOND)
-struct S24 {
- template <int&> void f(){};
- template <> void f<composite.n1[2]>(){};
-};
-#else
-S24 s24;
-// expected-error@second.h:* {{'TemplateArgument::S24' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'f' with composite.n1[2] for 1st template argument}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'f' with composite.n1[1] for 1st template argument}}
-#endif
-
-#if defined(FIRST) || defined(SECOND)
-struct S25 {
- template <int&> void f();
- template <> void f<composite.n1[2]>();
-};
-#else
-S25 s25;
-#endif
-
-#if defined(FIRST)
-struct S26 {
- template <int*> void f(){};
- template <> void f<&composite.n1[4]>(){}; // Past-the-end pointer.
-};
-#elif defined(SECOND)
-struct S26 {
- template <int*> void f(){};
- template <> void f<&composite.n2[0]>(){};
-};
-#else
-S26 s26;
-// expected-error@second.h:* {{'TemplateArgument::S26' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'f' with &composite.n2[0] for 1st template argument}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'f' with &composite.n1[4] for 1st template argument}}
-#endif
-
-#if defined(FIRST) || defined(SECOND)
-union Union {
- int i1;
- int i2;
-};
-extern Union u;
-#endif
-
-#if defined(FIRST)
-struct S27 {
- template <int&> void f(){};
- template <> void f<u.i1>(){};
-};
-#elif defined(SECOND)
-struct S27 {
- template <int&> void f(){};
- template <> void f<u.i2>(){};
-};
-#else
-S27 s27;
-// expected-error@second.h:* {{'TemplateArgument::S27' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'f' with u.i2 for 1st template argument}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'f' with u.i1 for 1st template argument}}
-#endif
-
-#if defined(FIRST) || defined(SECOND)
-struct S28 {
- template <int&> void f(){};
- template <> void f<u.i1>(){};
-};
-#else
-S28 s28;
-#endif
-
-#if defined(FIRST) || defined(SECOND)
-struct A {
- int a;
-};
-struct B : A {};
-struct C : A {};
-struct D : B, C {};
-#endif
-
-#if defined(FIRST)
-struct S29 {
- template <int D::*> void f(){};
- template <> void f<(int D::*)(int B::*)&A::a>(){};
-};
-#elif defined(SECOND)
-struct S29 {
- template <int D::*> void f(){};
- template <> void f<(int D::*)(int C::*)&A::a>(){};
-};
-#else
-S29 s29;
-// expected-error@second.h:* {{'TemplateArgument::S29' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'f' with &A::a for 1st template argument}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'f' with &A::a for 1st template argument}}
-#endif
-
-#if defined(FIRST) || defined(SECOND)
-struct S30 {
- template <int D::*> void f(){};
- template <> void f<(int D::*)(int B::*)&A::a>(){};
-};
-#else
-S30 s30;
-#endif
-
-#if defined(FIRST)
-struct S31 {
- template <auto*> void f(){};
- template <> void f<&composite.n1[2]>(){};
-};
-#elif defined(SECOND)
-struct S31 {
- template <auto*> void f(){};
- template <> void f<(void*)&composite.n1[2]>(){};
-};
-#else
-S31 s31;
-// expected-error@second.h:* {{'TemplateArgument::S31' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'f' with &composite.n1[2] for 1st template argument}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'f' with &composite.n1[2] for 1st template argument}}
-#endif
-
-#if defined(FIRST)
-struct S32 {
- template <int*> void f(){};
- template <> void f<__builtin_constant_p(0) ? (int*)1 : (int*)1>(){};
-};
-#elif defined(SECOND)
-struct S32 {
- template <int*> void f(){};
- template <> void f<__builtin_constant_p(0) ? (int*)2 : (int*)2>(){};
-};
-#else
-S32 s32;
-// expected-error@second.h:* {{'TemplateArgument::S32' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'f' with (int *)2 for 1st template argument}}
-// expected-note@first.h:* {{but in 'FirstModule' found method 'f' with (int *)1 for 1st template argument}}
-#endif
-
-#if defined(FIRST) || defined(SECOND)
-struct S33 {
- template <int*> void f(){};
- template <> void f<__builtin_constant_p(0) ? (int*)1 : (int*)1>(){};
-};
-#else
-S33 s33;
-#endif
-
#define DECLS \
OneClass<int> a; \
OneInt<1> b; \
diff --git a/clang/test/SemaCXX/warn-bool-conversion.cpp b/clang/test/SemaCXX/warn-bool-conversion.cpp
index c81d52d..7b671c5 100644
--- a/clang/test/SemaCXX/warn-bool-conversion.cpp
+++ b/clang/test/SemaCXX/warn-bool-conversion.cpp
@@ -186,7 +186,6 @@ namespace macros {
}
}
-#if __cplusplus < 201703L
namespace Template {
// FIXME: These cases should not warn.
template<int *p> void f() { if (p) {} } // expected-warning 2{{will always evaluate to 'true'}} expected-cxx11-warning {{implicit conversion of nullptr}}
@@ -206,4 +205,3 @@ namespace Template {
#endif
template void h<d>();
}
-#endif // __cplusplus < 201703L
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
index ae06055..b54b5a8 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
@@ -2,7 +2,7 @@
template<typename T, T val> struct A {};
-template<typename T, typename U> constexpr bool is_same = false;
+template<typename T, typename U> constexpr bool is_same = false; // expected-note +{{here}}
template<typename T> constexpr bool is_same<T, T> = true;
namespace String {
@@ -84,32 +84,34 @@ namespace PtrMem {
constexpr int B::*b = &B::b;
constexpr int C::*cb = b;
constexpr int D::*db = b;
- constexpr int E::*ecb = cb;
- constexpr int E::*edb = db;
+ constexpr int E::*ecb = cb; // expected-note +{{here}}
+ constexpr int E::*edb = db; // expected-note +{{here}}
constexpr int E::*e = &E::e;
constexpr int D::*de = (int D::*)e;
constexpr int C::*ce = (int C::*)e;
- constexpr int B::*bde = (int B::*)de;
- constexpr int B::*bce = (int B::*)ce;
+ constexpr int B::*bde = (int B::*)de; // expected-note +{{here}}
+ constexpr int B::*bce = (int B::*)ce; // expected-note +{{here}}
+ // FIXME: This should all be accepted, but we don't yet have a representation
+ // nor mangling for this form of template argument.
using Ab = A<int B::*, b>;
using Ab = A<int B::*, &B::b>;
- using Abce = A<int B::*, bce>;
- using Abde = A<int B::*, bde>;
- static_assert(!is_same<Ab, Abce>, "");
- static_assert(!is_same<Ab, Abde>, "");
- static_assert(!is_same<Abce, Abde>, "");
- static_assert(is_same<Abce, A<int B::*, (int B::*)(int C::*)&E::e>>, "");
+ using Abce = A<int B::*, bce>; // expected-error {{not supported}}
+ using Abde = A<int B::*, bde>; // expected-error {{not supported}}
+ static_assert(!is_same<Ab, Abce>, ""); // expected-error {{undeclared}} expected-error {{must be a type}}
+ static_assert(!is_same<Ab, Abde>, ""); // expected-error {{undeclared}} expected-error {{must be a type}}
+ static_assert(!is_same<Abce, Abde>, ""); // expected-error 2{{undeclared}} expected-error {{must be a type}}
+ static_assert(is_same<Abce, A<int B::*, (int B::*)(int C::*)&E::e>>, ""); // expected-error {{undeclared}} expected-error {{not supported}}
using Ae = A<int E::*, e>;
using Ae = A<int E::*, &E::e>;
- using Aecb = A<int E::*, ecb>;
- using Aedb = A<int E::*, edb>;
- static_assert(!is_same<Ae, Aecb>, "");
- static_assert(!is_same<Ae, Aedb>, "");
- static_assert(!is_same<Aecb, Aedb>, "");
- static_assert(is_same<Aecb, A<int E::*, (int E::*)(int C::*)&B::b>>, "");
+ using Aecb = A<int E::*, ecb>; // expected-error {{not supported}}
+ using Aedb = A<int E::*, edb>; // expected-error {{not supported}}
+ static_assert(!is_same<Ae, Aecb>, ""); // expected-error {{undeclared}} expected-error {{must be a type}}
+ static_assert(!is_same<Ae, Aedb>, ""); // expected-error {{undeclared}} expected-error {{must be a type}}
+ static_assert(!is_same<Aecb, Aedb>, ""); // expected-error 2{{undeclared}} expected-error {{must be a type}}
+ static_assert(is_same<Aecb, A<int E::*, (int E::*)(int C::*)&B::b>>, ""); // expected-error {{undeclared}} expected-error {{not supported}}
using An = A<int E::*, nullptr>;
using A0 = A<int E::*, (int E::*)0>;
@@ -203,9 +205,9 @@ namespace Auto {
struct Y : X {};
void type_affects_identity(B<&X::n>) {}
- void type_affects_identity(B<(int Y::*)&X::n>) {}
+ void type_affects_identity(B<(int Y::*)&X::n>) {} // FIXME: expected-error {{non-type template argument of pointer-to-member type}}
void type_affects_identity(B<(const int X::*)&X::n>) {}
- void type_affects_identity(B<(const int Y::*)&X::n>) {}
+ void type_affects_identity(B<(const int Y::*)&X::n>) {} // FIXME: expected-error {{non-type template argument of pointer-to-member type}}
// A case where we need to do auto-deduction, and check whether the
// resulting dependent types match during partial ordering. These
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}}