Incomplete inner classes bug (VC2008SP1)

Back to Compiler bugs

Because templates are involved, no code for A::f is instantiated until it is referred to. Therefore, it should be legal to use B:s constructors in f although the definition of B is yet to follow.

template <typename Type>
class C
{
public:
    class A;
    class B;
};

template <typename Type>
class C<Type>::A
{
public:
    B f() const
    {
        return B();
    }
};

template <typename Type>
class C<Type>::B
{
};

int main()
{
    C<int> c;

    return 0;
}