This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1273. Accessibility and function signatures

Section: 13.10.3  [temp.deduct]     Status: NAD     Submitter: Jason Merrill     Date: 2011-03-24

With the resolution of issue 1170, which takes access into account in template argument deduction, it is now possible to have instantiation-dependent expressions (see issue 1172) that do not directly involve a template parameter. For example:

  template <class T> struct C;

  class A
  {
    int i;
    friend struct C<int>;
  } a;

  class B
  {
    int i;
    friend struct C<float>;
  } b;

  template <class T>
  struct C
  {
    template <class U> decltype (a.i) f() { } // #1
    template <class U> decltype (b.i) f() { } // #2
  };

  int main()
  {
    C<int>().f<int>();   // calls #1
    C<float>().f<float>(); // calls #2
  }

Rationale (August, 2011):

The specification is as intended. To the extent that there is an issue here, it is covered by issue 1172.