Debian Codegraph @

gcc/testsuite/g++.dg/lookup/template3.C

raw
1 // Origin PR c++/47957
2 // { dg-do compile }
3
4 struct S
5 {
6 int m;
7
8 S()
9 : m(0)
10 {
11 }
12 };
13
14 struct Base
15 {
16 typedef S T;
17 };
18
19 template<class T>
20 struct Derived : public Base
21 {
22 int
23 foo()
24 {
25 T a; // This is Base::T, not the template parameter.
26 return a.m;
27 }
28 };
29
30 int
31 main()
32 {
33 Derived<char> d;
34 return d.foo();
35 }