1 // PR c++/47721 2 // { dg-do compile { target c++11 } } 3 4 // template type parameter friend: 5 6 template<class W> 7 class Q 8 { 9 static const int I = 2; 10 public: 11 friend W; 12 }; 13 14 struct B 15 { 16 int ar[Q<B>::I]; 17 }; 18 19 // bonus template template parameter friend: 20 21 template <class T> struct A; 22 23 template<template <class> class W> 24 class P 25 { 26 static const int I = 2; 27 public: 28 // I'm not sure this is well-formed, but I can't find anything 29 // that says otherwise. 30 template <class T> friend class W; 31 }; 32 33 template <class T> 34 struct A 35 { 36 int ar[P<A>::I]; 37 }; 38 39 A<int> a; 40 41