public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mukesh Kapoor <mukesh.kapoor@oracle.com>
To: Nathan Sidwell <nathan@acm.org>, gcc-patches@gcc.gnu.org
Cc: jason@redhat.com
Subject: Re: [C++ Patch] PR 80955 (Macros expanded in definition of user-defined literals)
Date: Fri, 20 Oct 2017 20:56:00 -0000	[thread overview]
Message-ID: <4e6e0a54-cf50-8944-a1bd-18f11d8b506c@oracle.com> (raw)
In-Reply-To: <8d9f3e13-9b65-da73-499c-05e569eef046@oracle.com>



On 10/20/2017 11:00 AM, Mukesh Kapoor wrote:
> Hi,
>
> On 10/20/2017 10:45 AM, Nathan Sidwell wrote:
>> On 10/20/2017 12:37 PM, Mukesh Kapoor wrote:
>>> Hi,
>>>
>>> This patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80955.
>>> Handle user-defined literals correctly in lex_string(). An empty 
>>> string followed by an identifier is
>>> a valid user-defined literal. Don't issue a warning for this case.
>>
>> a) why do we trigger on the definition of the operator function, and 
>> not on the use site?
>
> Actually, the current compiler issues an error (incorrectly) at both 
> places: at the definition as well as at its use.
>
>>
>> b) Why is the empty string special cased?  Doesn't the same logic 
>> apply to:
>>
>> int operator "bob"_zero (const char *, size_t) { return 0;}
>
> This is not a valid user-defined literal and is already reported as an 
> error by the compiler. After my changes it's still reported as an error.
> The empty string immediately followed by an identifier is a special 
> case because it's a valid user-defined literal in C++. ""_zero is a 
> valid user-defined literal.

Sorry, I used incorrect terminology here. An empty string immediately 
followed by an identifier is a valid name for a literal operator; 
""_zero is a valid name for a literal operator.

Mukesh

>
> Mukesh
>
>>
>> (that'd be a syntactic error in the C++ parser of course)
>>
>> nathan
>>
>

  reply	other threads:[~2017-10-20 19:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 17:03 Mukesh Kapoor
2017-10-20 18:00 ` Nathan Sidwell
2017-10-20 18:19   ` Mukesh Kapoor
2017-10-20 20:56     ` Mukesh Kapoor [this message]
2017-10-24 14:07       ` Jason Merrill
2017-10-25  5:48         ` Mukesh Kapoor
2017-10-25 11:26           ` Nathan Sidwell
2017-10-25 16:13             ` Jason Merrill
2017-10-25 16:14               ` Mukesh Kapoor
2017-10-26  3:30             ` Mukesh Kapoor
2017-10-31 16:26               ` Mukesh Kapoor
2017-11-01 20:02                 ` Jason Merrill
2017-11-01 20:44                   ` Mukesh Kapoor
2017-11-02 14:42                     ` Jason Merrill
2017-11-03 14:31                       ` Paolo Carlini
2017-11-04 22:38                         ` Mukesh Kapoor
2017-11-06 10:30                           ` Paolo Carlini

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=4e6e0a54-cf50-8944-a1bd-18f11d8b506c@oracle.com \
    --to=mukesh.kapoor@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=nathan@acm.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).