[Bug c++/35268] New: ICE on virtual function in template with pointer-to-member-function template parameter
circuitben at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 20 20:07:00 GMT 2008
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>();
}
--
Summary: ICE on virtual function in template with pointer-to-
member-function template parameter
Product: gcc
Version: 4.1.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: circuitben at gmail dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35268
More information about the Gcc-bugs
mailing list