[Bug preprocessor/69792] New: spurious warning for UDL declaration with parenthesized literal-operator-id
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 12 21:27:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69792
Bug ID: 69792
Summary: spurious warning for UDL declaration with
parenthesized literal-operator-id
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
This example surrounds operator""_min in parentheses, to protect it from
macros:
#define _min(a, b) (((a) < (b)) ? (a) : (b))
long double (operator""_min)(long double m) { return m; }
long double d = 1.0_min;
But the preprocessor thinks that (operator""_min) is a string literal followed
by a token, and so complains there is no whitespace:
bug.cc:2:22: warning: invalid suffix on literal; C++11 requires a space between
literal and string macro [-Wliteral-suffix]
long double (operator""_min)(long double m) { return m; }
^
This isn't a literal with an invalid suffix, but a literal-operator-id.
There's a simple workaround, which is to add the suggested whitespace, which
works, but not for the reason the preprocessor thinks it works :-)
More information about the Gcc-bugs
mailing list