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

Using a partial-concept-id in a template-introduction #92

Open
CaseyCarter opened this issue Sep 16, 2015 · 2 comments
Open

Using a partial-concept-id in a template-introduction #92

CaseyCarter opened this issue Sep 16, 2015 · 2 comments

Comments

@CaseyCarter
Copy link
Contributor

The grammar allows the use of a partial-concept-id in a template-introduction, e.g.,

template <class T, class U> concept bool Common() { return /* */ }

Common<int>{T}
auto f(T t) { return t != 0 ? t : 42; }

which I would expect to be equivalent to

template <class T>
  requires Common<T, int>()
auto f(T t) { return t != 0 ? t : 42; }

However, the rules for concept resolution in [temp.constr.resolve]/3 don't properly specify behavior for a concept name used in a partial-concept-id in a template-introduction. Bullet 3.2 is the only one concerned with template-introductions:

  • If C is the concept-name in a template-introduction. the concept argument list is a sequence
    of wildcards of the same length as the introduction-list of the template-introduction.

to allow for use of a partial-concept-id in a template-introduction, I think this needs to be replaced with:

  • If C is part of a template-introduction,
    • If the template-introduction consists solely of the concept-name C, the concept argument list is a sequence of wildcards of the same length as the introduction-list of the template-introduction.
    • If C is the concept-name of a partial-concept-id, the concept argument list is a sequence of wildcards of the same length as the introduction-list of the template-introduction followed by the arguments that appear in the template-argument-list of the partial-concept-id.
@CaseyCarter
Copy link
Contributor Author

I suppose the obvious alternative solution is to change the grammar of template-introduction to forbid _partial-concept-id_s; something like

template-introduction: nested-name-specifieropt concept-name { introduction-list }.

Apologies if this isn't the correct place to report issues with the TS, I haven't heard anything about the to-be-created issue repository. Let me know if it would be more appropriate to post this to c++std-core.

@asutton
Copy link
Contributor

asutton commented Sep 16, 2015

This is fine. The issues list will be a published document (I still need to
create it).

I don't think I'd ever anticipated a partial-concept-id in that position.
Disallowing it seems reasonable.

Andrew Sutton

On Tue, Sep 15, 2015 at 11:37 PM, Casey Carter [email protected]
wrote:

I suppose the obvious alternative solution is to change the grammar of
template-introduction to forbid _partial-concept-id_s; something like

template-introduction: nested-name-specifieropt concept-name {
introduction-list }
.

Apologies if this isn't the correct place to report issues with the TS, I
haven't heard anything about the to-be-created issue repository. Let me
know if it would be more appropriate to post this to c++std-core.


Reply to this email directly or view it on GitHub
#92 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants