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++/52768] New: Unable to get pointer to template function


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52768

             Bug #: 52768
           Summary: Unable to get pointer to template function
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kmakaron11@gmail.com


GCC 4.6.3, as well as GCC 4.8 cannot resolve template method, even if it is
explicitly instantiated.
The code to explain the problem is:

template <class T>
struct Creator
{
    template <typename...Ts>
    static std::shared_ptr<T> create(Ts&&... vs)
    {
        std::shared_ptr<T> t(new T(std::forward<Ts>(vs)...));
        return t;
    }
};

class Car:
        public Creator<Car>
{
    private:
        friend class Creator<Car>;
        Car()
        {
        }
};

int main()
{
    std::function< std::shared_ptr<Car> () > createFn=&Car::create<>;

    return 0;
}

This results in following compiler error:
error: conversion from â<unresolved overloaded function type>â
       to non-scalar type âstd::function<std::shared_ptr<Car>()>â requested

However it compiles fine on Clang3.0 and 3.1.


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