Topic: name of class as name of nonconstructor member


Author: daniel.edelson@inria.fr (Daniel R. Edelson)
Date: 21 Jul 92 12:12:23 GMT
Raw View
I think the following code is illegal, but am not
certain the draft Standard contains a prohibition.

   struct S {
 int S;
   };

Without explicitly discussing this case (as far as I have
discovered), I think the draft Standard forbids this for the
following reason.

 Whether or not the user declares one, S has a
 constructor. There may not be an outline function
 emitted, but S::S() can be called. Therefore, the
 declaration of "int S" redeclares as a datum an
 identifier that is already declared in the same
 scope to be a function.

I don't consider this argument completely waterproof.
If someone can phrase it more convincingly, I'd appreciate
hearing the argument.

Thanks a bunch,
Daniel
daniel.edelson@inria.fr






Author: daniel.edelson@inria.fr (Daniel R. Edelson)
Date: 22 Jul 92 09:22:18 GMT
Raw View
In article <4011@seti.UUCP>, daniel.edelson@inria.fr (Daniel R. Edelson) writes:
|> I think the following code is illegal, but am not
|> certain the draft Standard contains a prohibition.
|>
|>    struct S {
|>  int S;
|>    };

Thanks to Jerry Swartz for pointing out the last line of
section 9.2. The code is legal.