Skip to content

Commit 7c55515

Browse files
committed
Add nested pack tests
1 parent 7a9c8f2 commit 7c55515

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

clang/test/SemaCXX/cxx2c-fold-exprs.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,41 @@ void g() {
237237
}
238238

239239
}
240+
241+
namespace nested {
242+
243+
template <typename... T>
244+
struct S {
245+
template <typename... U>
246+
consteval static int f()
247+
requires ((A<T> && ...) && ... && A<U> ) {
248+
return 1;
249+
}
250+
251+
template <typename... U>
252+
consteval static int f()
253+
requires ((C<T> && ...) && ... && C<U> ) {
254+
return 2;
255+
}
256+
257+
template <typename... U>
258+
consteval static int g() // #nested-ambiguous-g1
259+
requires ((A<T> && ...) && ... && A<U> ) {
260+
return 1;
261+
}
262+
263+
template <typename... U>
264+
consteval static int g() // #nested-ambiguous-g2
265+
requires ((C<U> && ...) && ... && C<T> ) {
266+
return 2;
267+
}
268+
};
269+
270+
static_assert(S<int>::f<int>() == 2);
271+
272+
static_assert(S<int>::g<int>() == 2); // expected-error {{call to 'g' is ambiguous}}
273+
// expected-note@#nested-ambiguous-g1 {{candidate}}
274+
// expected-note@#nested-ambiguous-g2 {{candidate}}
275+
276+
277+
}

0 commit comments

Comments
 (0)