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: [C++/52595] template in NSDMI initializer


ping? or do you want to leave this dormant until 325 is resolved (which doesn't seem to be any time soon ...)

https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02892.html

On 05/27/15 16:05, Nathan Sidwell wrote:
this patch fixes 52595, which I'd not noticed was actually suspended.  anyway,
when parsing an NSDMI initializer of the form:

   int var = A<T,N>::foo();

we have to figure whether the ',' is ending the initializer or not.  We've
noticed the '<' as a potential template arg list opener.  Currently we
tentatively parse a declarator after the ',', and if successful presume the ','
ends the initializer.

That's not good enough, because, as in this case, 'N' is a perfectly fine
declarator.  This patch extends the tentative parsing to check the token after
the declarator.

If it is a ',' then we repeat, looking for another declarator.

If it is a ';' or '=' we treat the original ',' as ending the initializer.  I
don't think there are other valid alternatives for post-declarator token.

Otherwise we presume the ',' is part of a template-id.

booted and tested on x86_64-linux, ok?

nathan


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