Subject: problem with inner classes in template functions
From: [email-masked] (Oliver Glier)

21 May 1997 10:43:12 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Mailer: Mozilla 4.0b4 [en] (Win95; I)
Original-To: [email-masked]
X-Priority: 3 (Normal)
Original-Sender: [email-masked]

Dear peoply from the GNU-WIN32 project,
my name is Oliver Glier and I'm porting a C++ class library to
Windows. The code is already compilable by Borland C++,
Sun Sparc C++, and GCC 2.7 (EMX , Linux, and Sun).
My problem is that I would like to use your compiler (beta 1.8) ,
but it  doesn't accept the following construct:

template<class T>
class Container
{
public:
  class Iterator {
    public:
      void setnull();
  };
};

template<class C>
void createIterator(const C&)
{
  C::Iterator it;
  it.setnull();
}

void test()
{
  Container<int> numbers;
  createIterator(numbers);
}

The compiler always yields a syntax error at the line with
"C::Iterator it;" in function createIterator(). The funny thing is
that the compiler rejects the code before createIterator(
Container<int>) is generated, that is, while createIterator()
is nothing more than a raw template. Still, I think that
code as above is correct C++. At least it works with a lot
of other C++ compilers and seems to be important in the
use of class libraries such as STL.

Last but not least I must say that I'm very grateful for your
efforts of porting GNU C++ to Windows. You project is
great and I hope the best for its future.

With best regards,
Oliver.

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".