Nested protected class within namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have the following code:

----------
namespace NameSpace {
class Outer {
public:
  class Inner {};
  friend Inner * convertInner(int i);
protected:
  class InnerSetup : public Inner {};
};
}

NameSpace::Outer::Inner * NameSpace::convertInner(int i) {
  if (i == 0) return new NameSpace::Outer::Inner();
  else        return new NameSpace::Outer::InnerSetup();
}
----------

It compiles fine with g++ version 4.0.1, but newer versions (4.2.1 and 4.4.0) give me the following error:

example.cpp:11: error: 'NameSpace::Outer::Inner* NameSpace::convertInner(int)' should have been declared inside 'NameSpace'

It looks to me like the function IS declared inside 'NameSpace', so I can't tell what the compiler is trying to tell me.

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-0154      **
** Albuquerque, NM 87185-0370    Email: wfspotz@xxxxxxxxxx **







[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux