This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44239] New: Spurious partial explicit specialization when taking the address of a template function.
- From: "cjoldfield at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 May 2010 08:11:25 -0000
- Subject: [Bug c++/44239] New: Spurious partial explicit specialization when taking the address of a template function.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Problem:
template <class T>
const T& max(const T& x, const T& y){
return x > y ? x : y;
}
template <class T, class C>
const T& max(const T& x, const T& y, C comp){
return comp(x, y) ? y : x;
}
template <class R, class A0, class A1>
struct functor{
template <class F>
functor(F f) : f(f) {}
R (*f)(A0, A1);
};
int main(void){
functor<const int&, const int&, const int&> func(&max<int>);
return 0;
}
results in "error: no matching function for call to ?functor<const int&, const
int&, const int&>::functor(<unresolved overloaded function type>)?" Only
candidate constructor is the default copy constructor.
After removing the two parameter max template, compiles clean. The code is
boiled down from a problem using std::max with boost::function.
--
Summary: Spurious partial explicit specialization when taking the
address of a template function.
Product: gcc
Version: 4.3.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cjoldfield at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44239