view gcc/testsuite/g++.dg/cpp1y/auto-fn32.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile { target c++14 } }

template<class,class> struct same_type;
template<class T> struct same_type<T,T> {};

struct A
{
  static int b;
  int c;

  template <int>
  decltype(auto) f() { return A::c; }

  template <int>
  decltype(auto) g() { return (A::c); }
};

A a;

template <int>
decltype(auto) f() { return A::b; }

template <int>
decltype(auto) g() { return (A::b); }

int main()
{
  same_type<decltype(f<0>()), int>();
  same_type<decltype(g<0>()), int&>();

  same_type<decltype(a.f<0>()), int>();
  same_type<decltype(a.g<0>()), int&>();
}