A template parameter is provided by a function call parameter (which should be rejected as it is non-constant). The ICE does not occur (and an appropriate error is issued) if the code is rewritten so that func is an int or a pointer to a non-member function. class Object { public: void something() { } }; template<typename F, F func> class Action { public: // Removing "virtual" prevents the error. virtual void run() { // Removing the next line prevents the error. (object->*func)(); } Object *object; }; template<typename F> void *make_action(F func) { // Replacing func with &Object::something prevents the error. return new Action<F, func>(); } void bug() { make_action(&Object::something); // Not using the templated function prevents the error: //new Action<typeof(&Object::something), &Object::something>(); }
*** This bug has been marked as a duplicate of 37093 ***