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


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.

No. We are looking it up normally, but the member function declaration has not been processed yet, so lookup finds the outer declaration.


Without a special rule, this would be well-formed. I assume that the rule is there to allow for compilers to use some sort of delayed parsing of member declarations.

I guess that we were missing this diagnostic before by accident, because of the different DECL_NAMEs for class template instantiations. If we want to avoid the memory usage for different DECL_NAMEs, I'd think you'd have to hack around a lot to avoid giving this (correct) diagnostic here.

My inclination would be to make the change, and downgrade the error to pedwarn. There's no need for it to be a hard error.

Jason


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