This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/44239] New: Spurious partial explicit specialization when taking the address of a template function.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]