This is the mail archive of the 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]
Other format: [Raw text]

Re: [PATCH][C++] Fix PR29433, make C++ use a lot less time/memory

On Mon, 11 Dec 2006, Nathan Sidwell wrote:

| Jason Merrill wrote:
| > When we see the first T in "T T();" we have no idea that it's supposed
| > to be a type-specifier, so we can't look it up specially.
| I don't understand, we must be looking it up specially, otherwise the struct
| stat hack wouldn't work.

But, what "struct stat hack" means is specifically described in the
Standard.  No where the standard says the compiler must forcefully
make struct stat hack work when the conditions the Standard describes
are not met.

| Except for cdtors & conversion ops, declarations have a leading type specifier
| right?  So the first T in 'T T()' should be looked up as a type specifier?

I'm missing the paragraph in the standard that says the first "T" must
be looked up as a type-specifier.  Please could you point me to a reference?

| Otherwise I don't see how
| int T;
| struct S {
| 	struct T {};
| 	T T ();  // #1
| };
| is being parsed (we accept that).

But, it is invalid for the same reason (re-evaluation not yielding
the same declaration).

|  Why are we allowing the first T in #1 to
| lookup the type tag 'struct S::T' and not the decl '::T'?
| But we reject the following:
| struct S {
|    int T;
|    struct T {};
|    T baz ();
| };

Because the "T" that names the struct is hidden -- see 3.3.7/2.
EDG front-end cited earlier also rejects it.  I don't believe your
interpretation that the first "T" must be looked up as a
type-specifier is blessed by the Standard.

| yuck!

Yes :-)

-- Gaby

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