Sunday, 15 September 2013

Out-of-line definition of base class' nested class

Out-of-line definition of base class' nested class

Is the following code valid?
class A
{
class nested;
};
class B : public A {};
class B::nested {};
gcc accepts it, but clang rejects it with the following error:
test.cpp:8:14: error: no class named 'nested' in 'B'
class B::nested {};
~~~^

No comments:

Post a Comment