1 // Core 1273
2 // { dg-do compile { target c++11 } }
3 
4 template <class T> struct C;
5 template <class T> struct D;
6 
7 class A
8 {
9   int i;
10   static int j;
11   friend struct C<int>;
12   friend struct D<int>;
13 } a;
14 
15 class B
16 {
17   int i;
18   static int j;
19   friend struct C<float>;
20   friend struct D<float>;
21 } b;
22 
23 template <class T>
24 struct C
25 {
26   template <class U> decltype (a.i) f() { return 0; } // #1
27   template <class U> decltype (b.i) f() { return 1; } // #2
28 };
29 
30 template <class T>
31 struct D
32 {
33   template <class U> decltype (A::j) f() { return 2; } // #1
34   template <class U> decltype (B::j) f() { return 3; } // #2
35 };
36 
37 int main()
38 {
39   C<int>().f<int>();     // calls #1
40   C<float>().f<float>(); // calls #2
41   D<int>().f<int>();     // calls #1
42   D<float>().f<float>(); // calls #2
43 }
44