This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


2584. Equivalent types in function template declarations

Section:  []     Status: open     Submitter: Jim X     Date: 2022-04-08

According to 6.4.1 [basic.scope.scope] paragraph 4:

Two declarations correspond if they (re)introduce the same name, both declare constructors, or both declare destructors, unless

Assuming that two non-object-parameter-type-lists are equivalent if they have the same length and corresponding types are equivalent, the question remains when two (possibly dependent) types are equivalent. Subclause [] should provide an answer, but only covers expressions appearing in such types (paragraph 5):

Two expressions involving template parameters are considered equivalent if...

For example, the standard should specify whether these declarations correspond:

  template<class T> T   f();
  template<class T> T&& f();

  template<class T, class U> void g(decltype(T::foo));
  template<class T, class U> void g(decltype(U::foo));

A related issue is the determination whether two names are the same; for example:

  struct A {
    template<class T>
    operator T();

    template<class T>
    operator T&&();

The latter issue could probably be fixed by amending [class.conv.fct] to state that two conversion-function-ids are the same if their conversion-type-ids denote equivalent types, with a cross-reference to [].