public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Edward Diener <eldlistmailingz@tropicsoft.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Possible __VA_OPT__ bug
Date: Thu, 31 Oct 2019 17:15:00 -0000	[thread overview]
Message-ID: <20191031171458.GU28442@gate.crashing.org> (raw)
In-Reply-To: <qpf2uf$7gpc$1@blaine.gmane.org>

Hi Edward,

On Thu, Oct 31, 2019 at 12:42:54PM -0400, Edward Diener wrote:
> Given:
> 
> #define NO_DATA
> #define TRY_VA_OPT(...)  __VA_OPT__ (0) 1
> 
> TRY_VA_OPT() -> expands to 1 as expected
> TRY_VA_OPT(NO_DATA) -> expands to 0 1 which is not expected
> 
> when compiled with gcc-9.2 with -std=c++2a.

Why is that not expected?  The variadic macro TRY_VA_OPT does get tokens
in its variable argument (namely, NO_DATA), so __VA_OPT__ expands to its
argument (which is 0).

https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html


Segher

  reply	other threads:[~2019-10-31 17:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 16:43 Edward Diener
2019-10-31 17:15 ` Segher Boessenkool [this message]
2019-10-31 18:50   ` Edward Diener
2019-10-31 20:21     ` Segher Boessenkool
2019-10-31 20:28       ` Edward Diener
2019-10-31 21:28         ` Jędrzej Dudkiewicz
2019-10-31 21:31           ` Jędrzej Dudkiewicz
2019-11-01 14:39 ` Edward Diener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191031171458.GU28442@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=eldlistmailingz@tropicsoft.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).