This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/69792] New: spurious warning for UDL declaration with parenthesized literal-operator-id
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 12 Feb 2016 21:27:14 +0000
- Subject: [Bug preprocessor/69792] New: spurious warning for UDL declaration with parenthesized literal-operator-id
- Auto-submitted: auto-generated
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 :-)