Should the following code compile in C++98/03?
struct Base
{
template <typename T> void func () { }
void norm() { }
};
struct Derived : public Base { };
template <typename U>
struct Usage
{
typedef void (U::*Method)();
Usage(Method test) { }
};
int main()
{
Usage<Derived> good(&Derived::norm);
// "Error: Cannot use void(*)() to initialize Usage<Derived>." on next line
Usage<Derived> bad(&Derived::func<int>);
return 0;
}
This code snippet worked just fine on nearly every compiler that I was able to try out; save Sun C++ 5.11 and Sun C++ 5.12.
Should that be a bug? If so, does anyone know if it has been reported to the vendor (currently Oracle)?
Edit:
I'll accept an answer that provide the proper relevant quotations from either the C++03 or C++11 standards documents. Or if you can provide information about a bug report with Oracle.