Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should a using command issue a warning when using a reserved identifier?

When using the line

using std::literals::chrono_literals::operator""s;

in g++ 6.3.0, the compiler issues a warning stating:

warning: literal operator suffixes not preceded by '_' are reserved for future standardization

using std::literals::chrono_literals::operator""s;

A similar warning is also issued in MSVS. However, clang 3.8.0 issues no such warning.

Since operator""s is defined by the standard for the chrono library shouldn't this not issue a warning since we are just importing the name and not defining one?

like image 569
NathanOliver Avatar asked Jan 03 '17 13:01

NathanOliver


1 Answers

Arguably, the wording is clear enough on this—[over.literal]/1:

Some literal suffix identifiers are reserved for future standardization; see 17.6.4.3.5. A declaration whose literal-operator-id uses such a literal suffix identifier is ill-formed; no diagnostic required.

This can be interpreted as referring to (UDL operator) declarations whose "name" is a literal-operator-id—which of course excludes your case, since literal-operator-ids are unqualified. Same goes for [reserved.names]/2, where the “context”s are declarations of user-defined literal operators.

like image 123
Columbo Avatar answered Nov 07 '22 18:11

Columbo