1 // { dg-do compile { target c++14 } }
2 
3 template<class,class> struct same_type;
4 template<class T> struct same_type<T,T> {};
5 
6 struct A
7 {
8   static int b;
9   int c;
10 
11   template <int>
12   decltype(auto) f() { return A::c; }
13 
14   template <int>
15   decltype(auto) g() { return (A::c); }
16 };
17 
18 A a;
19 
20 template <int>
21 decltype(auto) f() { return A::b; }
22 
23 template <int>
24 decltype(auto) g() { return (A::b); }
25 
26 int main()
27 {
28   same_type<decltype(f<0>()), int>();
29   same_type<decltype(g<0>()), int&>();
30 
31   same_type<decltype(a.f<0>()), int>();
32   same_type<decltype(a.g<0>()), int&>();
33 }
34