SSCCE of my problem is:
template <class T> class MyClass
{
template <void (MyClass::*M)() const> struct wrapper
{
virtual void call();
};
};
template <typename T>
template <void (MyClass<T>::*M)() const>
void MyClass<T>::wrapper<M>::call()
{
}
This code compiled in gcc but failed with error:
error: nested name specifier 'MyClass<T>::wrapper<M>::' for declaration does not refer into a class, class template or class template partial specialization
void MyClass<T>::wrapper<M>::call()
~~~~~~~~~~~~~~~~~~~~~~~~~^
in clang++. Why?
In class call definition solves the problem, I know. Any non pointer-to-method templates works fine everywhere. Experiments with template/typename has no result.
Possible workaround: consider using std::function instead of wrapper. It is not exactly the same (less constraint on which function pointers are acceptable) but it will compile on clang++ and simplify your code.
#include <functional>
template <class T> class MyClass
{
typedef std::function<void(void) const > wrapper;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With