OSDN Git Service

* treelang/compile/var_defs.tree: Adjust.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.pt / unify6.C
1 // { dg-do assemble  }
2
3 // Copyright (C) 1999 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 21 May 1999 <nathan@acm.org>
5
6 // Template deduction and type unification should not issue diagnostics when
7 // they're trying to see if it's possible.  Here deduction fails in some cases
8 // because you cant cv qualify a function type.
9
10 template<class T> void fn(){} // A
11
12 template<class T> void fn(T const *){} // B
13
14 // these next two specializations need to know if they're specializing A or B.
15 // They specialize A, because they can't instantiate B.
16
17 template<> void fn<int &>() {} // ok, specialize A
18
19 template<> void fn<void ()>() {} // ok, specialize A
20
21 // now make sure we moan when we really should
22 template<class T> void foo(T const *){}
23
24 void f()
25 {
26   foo<int &>(); // { dg-error "" } attempt to build int & const *
27   foo<void ()>(); // { dg-error "" } attempt to build void (const *)()
28 }
29
30 typedef void (*Fptr)();
31
32 template<class T> void PV(Fptr const &, T const * const &);
33 template<class T1, class T2> void PV(T1 const * const &, T2 const * const &);
34
35 void baz()
36 {
37   void *t;
38   PV(&baz, t);
39 }