summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.ns/template13.C
blob: a9559c7153b6409cac6856bed67f352b0ed43588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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" }