** I am trying to compile a program that looks like the following but the
compiler cannot recognize which class the nested class belongs to:

#include <iostream>


using namespace std;


template <typename T>
        struct A
        {
                class B;
                friend class B;
        };


template <>
        struct A<void>
        {
                class B;
                friend class B;
        };


template <typename T>
        struct A<T>::B
        {
                B() 
        {
            cout << __PRETTY_FUNCTION__ << endl;
        }
        };


int main()
{
    A<void>::B b;
}


** Reports:
nesttempspecbug.cpp: In function `int main()':
nesttempspecbug.cpp:35: error: aggregate `A<void>::B b' has incomplete type and
cannot be defined


-- 
           Summary: Nested class of specialized template class bug
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: philippe at fornux dot com
 GCC build triplet: gcc version 3.4.5 (mingw special)
  GCC host triplet: Windows XP
GCC target triplet: MinGW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35727

Reply via email to