public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65547] New: Gcc not giving preprocessor error for invalid invocation of variadic macro
@ 2015-03-25  3:51 eldlistmailingz at tropicsoft dot com
  2015-03-25  3:52 ` [Bug c++/65547] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: eldlistmailingz at tropicsoft dot com @ 2015-03-25  3:51 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-25 21:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25  3:51 [Bug c++/65547] New: Gcc not giving preprocessor error for invalid invocation of variadic macro eldlistmailingz at tropicsoft dot com
2015-03-25  3:52 ` [Bug c++/65547] " pinskia at gcc dot gnu.org
2015-03-25 11:46 ` redi at gcc dot gnu.org
2015-03-25 12:22 ` eldlistmailingz at tropicsoft dot com
2015-03-25 12:55 ` redi at gcc dot gnu.org
2015-03-25 22:53 ` eldlistmailingz at tropicsoft dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).