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] cannot resolve address of function template with empty template argument list


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-03-29
            Summary|Unable to get pointer to    |cannot resolve address of
                   |template function           |function template with
                   |                            |empty template argument
                   |                            |list
     Ever Confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-29 13:09:10 UTC ---
Same problem using a default template argument instead of a parameter pack:

template<typename Res>
struct function
{
    template<typename F> function(F) { }
};

template <class T>
struct Creator
{
    template <typename Ts = int>
    static T* create(Ts vs)
    {
        return new T(vs);
    }
};

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

int main()
{
    function< Car* () > createFn=&Car::create<>;
}

(technically this is a C++11 bug, but G++ supports variadic templates and
default template arguments for functions in c++98 mode)


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