K
Kaba
Consider the following code:
template <typename T>
class A
{
public:
class Direction
{
public:
enum Enum
{
Left, Right
};
};
void f()
{
Direction::Enum a = Direction::Left;
}
};
int main()
{
return 0;
}
Comeau and GCC (4.4.5) give a similar error:
"In member function ?void A<T>::f()?:
error: expected ?;? before ?a?"
Visual Studio 2008 compiles fine.
If the 'template <typename T>' is removed, then Comeau and Visual Studio
2008 compile it, while GCC gives:
/tmp/ccHbZ8n.eh_frame+0x12): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
Explanations for the behaviours?
template <typename T>
class A
{
public:
class Direction
{
public:
enum Enum
{
Left, Right
};
};
void f()
{
Direction::Enum a = Direction::Left;
}
};
int main()
{
return 0;
}
Comeau and GCC (4.4.5) give a similar error:
"In member function ?void A<T>::f()?:
error: expected ?;? before ?a?"
Visual Studio 2008 compiles fine.
If the 'template <typename T>' is removed, then Comeau and Visual Studio
2008 compile it, while GCC gives:
/tmp/ccHbZ8n.eh_frame+0x12): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
Explanations for the behaviours?