111
|
1 // { dg-do compile }
|
|
2
|
|
3 // Origin: Ivan Godard <igodard@pacbell.net>
|
|
4
|
|
5 // PR c++/15410: Declaration of friend class template with wrong
|
|
6 // template parameter.
|
|
7
|
|
8 template <typename T, typename U> struct F; // { dg-message "previous declaration" }
|
|
9
|
|
10 class W
|
|
11 {
|
|
12 template<int i> friend class F; // { dg-error "template parameter" }
|
|
13 int x; // { dg-message "private" }
|
|
14 };
|
|
15
|
|
16 template <typename T, typename U> struct F
|
|
17 {
|
|
18 void Look(W& w) { w.x = 3; } // { dg-error "within this context" }
|
|
19 };
|
|
20
|
|
21 int main()
|
|
22 {
|
|
23 W w;
|
|
24 F<char, bool> f;
|
|
25 f.Look(w);
|
|
26 return 0;
|
|
27 }
|