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
10template<class T> void fn(){} // A
11
12template<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
17template<> void fn<int &>() {} // ok, specialize A
18
19template<> void fn<void ()>() {} // ok, specialize A
20
21// now make sure we moan when we really should
22template<class T> void foo(T const *){}
23
24void f()
25{
26  foo<int &>(); // { dg-error "" } attempt to build int & const *
27  foo<void ()>(); // { dg-error "" } attempt to build void (const *)()
28}
29
30typedef void (*Fptr)();
31
32template<class T> void PV(Fptr const &, T const * const &);
33template<class T1, class T2> void PV(T1 const * const &, T2 const * const &);
34
35void baz()
36{
37  void *t;
38  PV(&baz, t);
39}
40