diff options
author | yronglin <yronglin777@gmail.com> | 2025-06-24 09:40:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-24 09:40:01 +0800 |
commit | bd6ee6ac21331352688a5e47c3b610ca36c696d5 (patch) | |
tree | d6ba4f6e4229858a1f875f7b01fde5265bad26b9 /clang/lib/Parse/ParseDecl.cpp | |
parent | 975d4df147adf1bcfe200222626dc0121bf2b787 (diff) | |
download | llvm-bd6ee6ac21331352688a5e47c3b610ca36c696d5.zip llvm-bd6ee6ac21331352688a5e47c3b610ca36c696d5.tar.gz llvm-bd6ee6ac21331352688a5e47c3b610ca36c696d5.tar.bz2 |
[C23][Parser] Accept single variadic parameter function declarator in type name (#145362)
Fixs: https://github.com/llvm/llvm-project/issues/145250.
This PR makes clang accept single variadic parameter function declarator
in type name.
Eg.
```c
int va_fn(...); // ok
// As typeof() argument
typeof(int(...))*fn_ptr = &va_fn; // ok
// As _Generic association type
int i = _Generic(typeof(va_fn), int(...):1); // ok
```
Signed-off-by: yronglin <yronglin777@gmail.com>
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 02f3351..7e739e0 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -7048,7 +7048,8 @@ void Parser::ParseParenDeclarator(Declarator &D) { // paren, because we haven't seen the identifier yet. isGrouping = true; } else if (Tok.is(tok::r_paren) || // 'int()' is a function. - (getLangOpts().CPlusPlus && Tok.is(tok::ellipsis) && + ((getLangOpts().CPlusPlus || getLangOpts().C23) && + Tok.is(tok::ellipsis) && NextToken().is(tok::r_paren)) || // C++ int(...) isDeclarationSpecifier( ImplicitTypenameContext::No) || // 'int(int)' is a function. |