[AMDGPU] Update base addr of dyn alloca considering GrowingUp stack (#119822)
[llvm-project.git] / clang / test / CXX / temp / temp.fct.spec / temp.deduct / temp.deduct.partial / p3.cpp
blobcc1d4ecda2ecca034e699864800449ead2af8e1e
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 template<bool B>
5 struct A { };
7 constexpr A<false> a;
8 constexpr A<false> b;
10 constexpr int* x = nullptr;
11 constexpr short* y = nullptr;
13 namespace ExplicitArgs {
14 template<typename T, typename U>
15 constexpr int f(U) noexcept(noexcept(T())) {
16 return 0;
19 template<typename T>
20 constexpr int f(T*) noexcept {
21 return 1;
24 template<>
25 constexpr int f<int>(int*) noexcept {
26 return 2;
29 static_assert(f<int>(1) == 0);
30 static_assert(f<short>(y) == 1);
31 static_assert(f<int>(x) == 2);
33 template<typename T, typename U>
34 constexpr int g(U*) noexcept(noexcept(T())) {
35 return 3;
38 template<typename T>
39 constexpr int g(T) noexcept {
40 return 4;
43 template<>
44 constexpr int g<int>(int*) noexcept {
45 return 5;
48 static_assert(g<int>(y) == 3);
49 static_assert(g<short>(1) == 4);
50 static_assert(g<int>(x) == 5);
51 } // namespace ExplicitArgs
53 namespace DeducedArgs {
54 template<typename T, bool B>
55 constexpr int f(T, A<B>) noexcept(B) {
56 return 0;
59 template<typename T, bool B>
60 constexpr int f(T*, A<B>) noexcept(B && B) {
61 return 1;
64 template<>
65 constexpr int f(int*, A<false>) {
66 return 2;
69 static_assert(f<int*>(x, a) == 0);
70 static_assert(f<short>(y, a) == 1);
71 static_assert(f<int>(x, a) == 2);
72 } // namespace DeducedArgs