Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PL103 13.01 [temp.param] Elaborate syntax for constrained type template parameters #102

wg21bot opened this issue Oct 23, 2019 · 2 comments
concepts Concepts EWG Evolution rejected No consensus for a change.


Copy link

wg21bot commented Oct 23, 2019

The current syntax for constrained type template parameters, especially after the recent change of the naming convention for the standard library, causes confusion about the difference between the following two templates (one takes a value parameter, the other takes a constrained type parameter):
template<bool B> struct foo {};
template<std::boolean B> struct foo {};
This is also inconsistent with the requirement to use the keyword auto for variable and parameter declarations with deduced constrained type:
template<std::boolean auto B> struct foo {};
The author of this comment believes that, regardless of what the naming convention for standard library concepts ends up being, this is going to be confusing in real life code, and introduce a place where the knowledge of whether a name designates a type or a concept is necessary to be able to tell the kind of a template parameter. Therefore, this comment proposes that the second definition above would have to be written as following
template<std::boolean class B> struct foo {};
In the future, if we decide that the perceived possible confusion between the first two definitions in this comment is not actually a problem, this can be further relaxed to allow the current syntax, similarly to how Concept auto foo is expected to be possible to relax in the future if the committee finds that to be desirable.

Proposed change:
In [temp.param]/1, replace the definition of the production rule type-parameter with:
type-constraintopt type-parameter-key ...opt identifier/opt
type-constraintopt type-parameter-key identifier/opt = type-id
template-head type-parameter-key .../opt identifier/opt
template-head type-parameter-key identifier/opt = id-expression
Throughout the rest of the draft, replace all uses of ConceptName TypeParameterName with ConceptName class TypeParameterName (or ConceptName typename TypeParameterName).

@wg21bot wg21bot added the EWG Evolution label Oct 23, 2019
@jfbastien jfbastien added the concepts Concepts label Oct 24, 2019
Copy link

jfbastien commented Nov 4, 2019

EWG Monday:

PL103 Does EWG want to consider this change for C++20

5 14

No consensus for change.

Copy link

jensmaurer commented Nov 7, 2019

Rejected. There was no consensus to adopt this change.

@jensmaurer jensmaurer added the rejected No consensus for a change. label Nov 7, 2019
@jensmaurer jensmaurer added this to the CD C++20 milestone Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
concepts Concepts EWG Evolution rejected No consensus for a change.
None yet

No branches or pull requests

3 participants