This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: definitions with qualified names


> struct A
> {
> struct A::B { ...whatever ... };
> };

This is ill-formed. 9.3/2 says

>> A member function definition that appears outside of the class
>> definition shall appear in a namespace scope enclosing the class
>> definition.


> namespace NMS
> {
>   int NMS::fn();  // missing pedwarn?
>   struct NMS::A {  // ICE
> 	};
> };
> 
> Any cluons going spare?

For the second one, egcs-2.93.19 gives me (without options)

a.cc:4: `NMS' does not have a nested type named `A'
a.cc:5: anonymous class type not used to declare any objects

For the first one, we do need to produce diagnostics. Please note that
it already considers the following ill-formed:

namespace A{
void fn();
}
namespace NMS
{
  int A::fn();
}

It says:
a.cc:6: declaration of `fn()' not in a namespace surrounding `A'


Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]