Issue 76375
Summary Clang wrongly warns about empty variadic argument lists for macros
Labels clang
Assignees
Reporter hasselmm
    Clang warns about empty variadic argument lists for macros if [-Wgnu-zero-variadic-macro-arguments](https://releases.llvm.org/17.0.1/tools/clang/docs/DiagnosticsReference.html#id380) is activated. This warning is wrong when compiling for C++ 20 or later mode. C++ 20 and later explicitly allow empty variadic argument lists for macros: https://eel.is/c++draft/cpp.replace.general#5

> If the [identifier-list](https://eel.is/c++draft/cpp.pre#nt:identifier-list) in the macro definition does not end with an ellipsis, the number of arguments (including those arguments consisting of no preprocessing tokens) in an invocation of a function-like macro shall equal the number of parameters in the macro definition[.](https://eel.is/c++draft/cpp.replace.general#5.sentence-1)
Otherwise, there shall be **at least as many arguments in the invocation as there are parameters in the macro definition (excluding the ...)**[.](https://eel.is/c++draft/cpp.replace.general#5.sentence-2)
There shall exist a ) preprocessing token that terminates the invocation[.](https://eel.is/c++draft/cpp.replace.general#5.sentence-3)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to