Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.ns/template13.C

raw
1 // { dg-do compile }
2 // Templates defined outside must be declared inside
3 namespace bar
4 {
5 // trick it to provide some prior declaration
6 template<class T>
7 void foo();
8 template<class T>class X; // { dg-message "note: previous declaration" }
9 }
10
11 template <typename T>
12 T const
13 bar::foo(T const &a) // { dg-error "" "" { xfail *-*-* } } not declared in bar -
14 {
15 return a;
16 }
17
18 template<> void bar::foo<int>() // { dg-error "different namespace" "" { target c++98_only } }
19 {
20 }
21
22 template<class T,class U>
23 class bar::X{}; // { dg-error "redeclared with 2 template parameter" }