-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Reference (section label): dcl.spec.general, dcl.fct.spec
Link to reflector thread (if any): https://lists.isocpp.org/core/2018/06/4673.php
Issue description:
It's not completely clear whether this is valid, but it is clear that it's nonsensical:
struct X {
explicit explicit(false) X(int);
};[dcl.spec]p2 says: "Each decl-specifier shall appear at most once in a complete decl-specifier-seq, except that long may appear twice."
But are explicit and explicit(false) the same decl-specifier? I don't think they are; they're different grammar productions, and they mean different things. I think we'd benefit from some clarification here. (Similarly, are explicit(true) and explicit(false) the same decl-specifier?)
We certainly do intend to allow you to combine (for example) virtual and explicit, so we can't say that this is invalid because each decl-specifier production is only allowed once -- those are both function-specifiers using the same decl-specifier production.
Suggested resolution:
Change in [dcl.spec]p2:
"Each decl-specifier shall appear at most once in a complete decl-specifier-seq, except that long may appear twice. A decl-specifier-seq shall not contain more than one explicit-specifier."