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