[C++-0x] User-defined literals.
Rodrigo Rivas
rodrigorivascosta@gmail.com
Wed Sep 22 19:35:00 GMT 2010
> I'm holding out for rolling back the lexer in some way that won't break everything and emitting the (unrecognized by cpp ) suffix as a separate identifier token. I'm thinking the cp_lexer_* routines or maybe a new one in parser.c would be worth trying. Then the code I have now would just work (except I would still need enhanced lookup rules as discussed earlier). It would be nice to have all types on the same page too.
Hmmm, you indend to break the user-defined integer/float into two
tokens: the number and the suffix. I don't know... it may cause quite
some unexpected problems. Note that the draft defines a
user-defined-literal as *one* token but you want to read it as *two*
tokens.
That would make ill-formed code parseable, for example:
int x = 10 /* whatever */ _foo;
On second thought, this already happens with strings and chars:
"xxx" /**/ _bar;
is parsed fine with your current patch, but I believe it should not.
Rodrigo.
More information about the Gcc
mailing list