class A
{
public:
int func(int v) { return v; }
};
template <typename T>
class Test
{
public:
typedef T (A::*funcptr_t)(T);
funcptr_t fnc;
};
template <typename T>
void gives_me_an_error()
{
Test<T>::funcptr_t ptr;
}
line 19 gives me the error:
error: expected `;' before ‘ptr
This same code works fine in VS, and works fine if I remove the template parts:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class A
{
public:
int func(int v) { return v; }
};
class Test
{
public:
typedefint (A::*funcptr_t)(int);
funcptr_t fnc;
};
void works_fine()
{
Test::funcptr_t ptr;
}
Anyone have any idea what the problem is and/or if what I'm doing is legal? And/or how to solve (if possible)?
Thanks in advance.
EDIT --
nevermind. I worked around it by making gives_me_an_error a static member of Test, rather than a global function.. which is probably better design anyway.