llvm-project/clang/test/Parser/cxx-variadic-func.cpp
Corentin Jabot 186176de45
[Clang] Do not consider a variadic function ellipsis part of a default arg (#153496)
When stashing the tokens of a parameter of a member function, we would
munch an ellipsis, as the only considered terminal conditions were `,`
and `)`.

Fixes #153445
2025-08-14 12:51:58 +02:00

30 lines
556 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(...) {
// FIXME: There's no disambiguation here; this is unambiguous.
int g(int(...)); // expected-warning {{disambiguated}} expected-note {{paren}}
}
void h(int n..., int m); // expected-error {{expected ')'}} expected-note {{to match}}
namespace GH153445 {
void f(int = {}...);
struct S {
void f(int = {}...);
void g(int...);
};
void S::g(int = {}...) {}
}
template <typename ...T>
constexpr int a() {return 1;}
struct S2 {
template <typename ...Ts>
void f(int = a<Ts...>()...);
};