Skip to content

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

@CaseyCarter

Description

@CaseyCarter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions