diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.ns/template13.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.ns/template13.C | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template13.C b/gcc/testsuite/g++.old-deja/g++.ns/template13.C new file mode 100644 index 000000000..a9559c715 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/template13.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// Templates defined outside must be declared inside +namespace bar +{ + // trick it to provide some prior declaration + template<class T> + void foo(); // { dg-error "definition" } + template<class T>class X; // { dg-message "note: previous declaration" } +} + +template <typename T> +T const +bar::foo(T const &a) // { dg-error "" "" { xfail *-*-* } } not declared in bar - +{ + return a; +} + +template<> void bar::foo<int>() // { dg-error "different namespace" } +{ +} + +template<class T,class U> +class bar::X{}; // { dg-error "redeclared with 2 template parameter" } |