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

861 views Asked by At

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?

1

There are 1 answers

16
Columbo On

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.