Thread View: comp.std.c++
2 messages
2 total messages
Started by Daniel R. Edelson
Tue, 21 Jul 1992 12:12
name of class as name of nonconstructor member
Author: Daniel R. Edelson
Date: Tue, 21 Jul 1992 12:12
Date: Tue, 21 Jul 1992 12:12
27 lines
1219 bytes
1219 bytes
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
Re: name of class as name of nonconstructor member
Author: Daniel R. Edelson
Date: Wed, 22 Jul 1992 09:22
Date: Wed, 22 Jul 1992 09:22
10 lines
825 bytes
825 bytes
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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads