Skip to content

Commit 9b53a6e

Browse files
authored
[Clang][NFC] Rearrange tests for CWG 2707 after #110473 (#110842)
This addresses comments from @Endilll in the post commit review of #110473.
1 parent d278fa5 commit 9b53a6e

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

clang/test/CXX/drs/cwg27xx.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -pedantic-errors -verify=expected %s
33
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++14 -pedantic-errors -verify=expected %s
44
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -pedantic-errors -verify=expected %s
5-
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -pedantic-errors -verify=expected %s
6-
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -pedantic-errors -verify=expected,since-cxx23 %s
7-
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -pedantic-errors -verify=expected,since-cxx23,since-cxx26 %s
5+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -pedantic-errors -verify=expected,since-cxx20 %s
6+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -pedantic-errors -verify=expected,since-cxx20,since-cxx23 %s
7+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -pedantic-errors -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s
88

99
#if __cplusplus == 199711L
1010
#define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
@@ -29,6 +29,35 @@ namespace std {
2929
#endif
3030
} // namespace std
3131

32+
namespace cwg2707 { // cwg2707: 20
33+
34+
#if __cplusplus >= 202002L
35+
36+
template <class T, unsigned N> struct A { // #cwg2707-A
37+
T value[N];
38+
};
39+
40+
template <typename... T>
41+
A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2); // #cwg2707-guide-A
42+
43+
// Brace elision is not allowed for synthesized CTAD guides if the array size
44+
// is value-dependent.
45+
// So this should pick up our explicit deduction guide.
46+
A a = {1, 2};
47+
48+
A b = {3, 4, 5};
49+
// since-cxx20-error@-1 {{no viable constructor or deduction guide}}
50+
// since-cxx20-note@#cwg2707-A {{candidate function template not viable}}
51+
// since-cxx20-note@#cwg2707-A {{implicit deduction guide}}
52+
// since-cxx20-note@#cwg2707-guide-A {{constraints not satisfied}}
53+
// since-cxx20-note@#cwg2707-guide-A {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}}
54+
// since-cxx20-note@#cwg2707-A {{candidate function template not viable}}
55+
// since-cxx20-note@#cwg2707-A {{implicit deduction guide}}
56+
57+
#endif
58+
59+
} // namespace cwg2707
60+
3261
namespace cwg2718 { // cwg2718: 2.7
3362
struct B {};
3463
struct D;
@@ -200,32 +229,3 @@ static_assert(false, f().s);
200229
// since-cxx26-error@-1 {{static assertion failed: Hello}}
201230
#endif
202231
} // namespace cwg2798
203-
204-
namespace cwg2707 { // cwg2707: 20
205-
206-
#if __cplusplus >= 202002L
207-
208-
template <class T, unsigned N> struct A {
209-
T value[N];
210-
};
211-
212-
template <typename... T>
213-
A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2);
214-
215-
// Brace elision is not allowed for synthesized CTAD guides if the array size
216-
// is value-dependent.
217-
// So this should pick up our explicit deduction guide.
218-
A a = {1, 2};
219-
220-
A b = {3, 4, 5};
221-
// expected-error@-1 {{no viable constructor or deduction guide}} \
222-
// expected-note@-13 {{candidate function template not viable}} \
223-
// expected-note@-13 {{implicit deduction guide}} \
224-
// expected-note@-8 {{constraints not satisfied}} \
225-
// expected-note@-8 {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}} \
226-
// expected-note@-13 {{candidate function template not viable}} \
227-
// expected-note@-13 {{implicit deduction guide}}
228-
229-
#endif
230-
231-
} // namespace cwg2707

0 commit comments

Comments
 (0)