Skip to content

CWG2603 [basic.scope.scope] Holistic functional equivalence for function templates #66

@opensdh

Description

@opensdh

Reference (section label): [basic.scope.scope]

Link to reflector thread (if any): was a StackOverflow question

Issue description:

In C++20, [temp.over.link]/7 defined equivalence for function templates in terms of equivalence of several of its components; functional equivalence for them was similar in that it was defined recursively for their "return types and parameter lists", but differed with regard to constraints in that it required that they "accept and are satisfied by the same set of template argument lists". P1787R6 simplified the treatment by relying entirely on the "depends on whether two constructs are equivalent, and they are functionally equivalent but not equivalent" rule to make the correspondence check between the function templates IFNDR.

This creates a situation where moving a constraint between a template-head and a requires-clause makes a function template truly different (because there is no reasonable way to read [basic.scope.scope]/4.3.2's "equivalent […], template-heads, and trailing requires-clauses (if any)" as requiring a joint check for functional equivalence), even if overload resolution would never be able to distinguish them.

Suggested resolution:

If this unintentional change is undesirable (e.g., for mangling reasons), restore some of what was deleted from [temp.over.link]/7, perhaps phrased as an additional rule ("If two function templates do not correspond but accept and are satisfied by the same set of template argument lists, …").

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