1// PR c++/58878 2 3// Template-members of non-template class 4struct A 5{ 6 template <typename t> // { dg-error "shadows" } 7 void f() 8 { 9 int t = 1; // { dg-error "declaration" } 10 } 11 12 template <typename t> 13 void g(); 14}; 15 16template <typename t> // { dg-error "shadows" } 17void A::g() 18{ 19 int t = 2; // { dg-error "declaration" } 20} 21 22// (Non-template) Members of template class 23template <typename t> // { dg-error "shadows" } 24struct B 25{ 26 void f() 27 { 28 int t = 3; // { dg-error "declaration" } 29 } 30 31 void g(); 32}; 33 34template <typename t> // { dg-error "shadows" } 35void B<t>::g() 36{ 37 int t = 4; // { dg-error "declaration" } 38} 39 40// Template members of template class 41template <typename t> // { dg-error "shadows" } 42struct C 43{ 44 template <typename s> // { dg-error "shadows" } 45 void f() 46 { 47 int t = 5; // { dg-error "declaration" } 48 int s = 6; // { dg-error "declaration" } 49 } 50 51 template <typename s> 52 void g(); 53}; 54 55template <typename t> // { dg-error "shadows" } 56template <typename s> // { dg-error "shadows" } 57void C<t>::g() 58{ 59 int t = 7; // { dg-error "declaration" } 60 int s = 8; // { dg-error "declaration" } 61} 62