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

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


Gabriel Dos Reis wrote:
On Sat, 9 Dec 2006, Mark Mitchell wrote:

| Gabriel Dos Reis wrote:
|
| > |   struct T {};
| > |   struct S {
| > |     T T();
| > |   };
| > |
| > | name lookup for the T appearing as a type-specifier would still find the
| > | outer T, and that therefore the binding to the member function T does
| > | not affect validity.
| >
| > I don't follow that reasoning.
|
| The standard says that its an error if name lookup would find a
| different binding after the class is complete.

yes.

|  But, it wouldn't: it
| would still find the global T, since type-specifiers are looked up
| specially.

I believe that special rule applies only if we used "struct" in front of
the first "T", e.g.

   struct T { };
   struct S {
      struct T T();
   };

is valid.

It also applies before ::, but that also doesn't apply to this case. 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.


Jason


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