Skip to content

Commit 38c43e1

Browse files
committed
fix tests for c++20
1 parent ebe396b commit 38c43e1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

clang/test/SemaTemplate/instantiate-template-argument.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
1+
// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify=expected,cxx20
2+
// RUN: %clang_cc1 -std=c++2c -x c++ %s -verify
3+
24

35
template<auto T, decltype(T) U>
46
concept C1 = sizeof(U) >= 4;
@@ -59,19 +61,22 @@ static_assert(foo<int, 'a'>() == 2);
5961

6062
namespace packs {
6163

62-
template<auto T, decltype(T)... U>
63-
concept C1 = (sizeof(U) && ...) >= 4;
64+
template<auto T, decltype(T) U>
65+
concept C1 = sizeof(U) >= 4;
6466

65-
template<typename Y, char... V>
66-
concept C2 = (C1<Y{}, V> && ...);
67+
template<typename Y, char V>
68+
concept C2 = C1<Y{}, V>;
6769

6870
template<char... W>
69-
constexpr int foo() requires (C2<int, W> && ...) { return 1; }
71+
constexpr int foo() requires (C2<int, W> && ...) { return 1; } // #packs-cand1
7072

7173
template<char... X>
72-
constexpr int foo() requires (C1<1, X> && ...) && true { return 2; }
74+
constexpr int foo() requires (C1<1, X> && ...) && true { return 2; } // #packs-cand2
7375

7476
static_assert(foo<'a'>() == 2);
77+
// cxx20-error@-1{{call to 'foo' is ambiguous}}
78+
// cxx20-note@#packs-cand1 {{candidate function}}
79+
// cxx20-note@#packs-cand2 {{candidate function}}
7580

7681
}
7782

0 commit comments

Comments
 (0)