Rebase.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.pt / unify6.C
blobd122ec2dcb9c7599056a36d092a747e051e86f5e
1 // { dg-do assemble  }
3 // Copyright (C) 1999 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 21 May 1999 <nathan@acm.org>
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.
10 template<class T> void fn(){} // A
12 template<class T> void fn(T const *){} // B
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.
17 template<> void fn<int &>() {} // ok, specialize A
19 template<> void fn<void ()>() {} // ok, specialize A
21 // now make sure we moan when we really should
22 template<class T> void foo(T const *){} // { dg-error "pointer to reference" }
24 void f()
26   foo<int &>(); // { dg-error "" } attempt to build int & const *
27   foo<void ()>(); // { dg-error "" } attempt to build void (const *)()
30 typedef void (*Fptr)();
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 &);
35 void baz()
37   void *t;
38   PV(&baz, t);