This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65547] New: Gcc not giving preprocessor error for invalid invocation of variadic macro
- From: "eldlistmailingz at tropicsoft dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Mar 2015 02:54:50 +0000
- Subject: [Bug c++/65547] New: Gcc not giving preprocessor error for invalid invocation of variadic macro
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65547
Bug ID: 65547
Summary: Gcc not giving preprocessor error for invalid
invocation of variadic macro
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eldlistmailingz at tropicsoft dot com
Given the variadic macro:
#define VMACRO(x,...) x __VA_ARGS__
if it is invoked with
VMACRO(1)
a compiler error should occur according to section 16.3 paragraph 4 of the
C++11 standard:
"If the 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. Otherwise, there shall be more
arguments in the invocation than there are parameters in the macro definition
(excluding the ...). There shall exist a ) preprocessing token that terminates
the invocation."
The second sentence is the relevant one.
Instead gcc outputs the warning:
"warning: ISO C99 requires rest arguments to be used".
But since the compile is done with C++11 support the reference should be to the
C++11 standard and an error should occur. That an error does not occur I
consider a bug.
Relevant command line parameters are:
"-ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g -Wno-variadic-macros
-ftrack-macro-expansion=0 -std=c++0x"
If there is some reason why this is a warning rather than a compiler error I
would like to know about it.