On Wed, 30 Mar 2011, Richard Trieu <[email protected]> wrote:
> Detect when the string "<::" is found in code after a cast or template
> name and is interpreted as "[:" because of the digraph "<:".  When found,
> give an error with a fix-it to add whitespace between the "<" and "::".
> Also, repair the token stream and recover parsing afterwards.

I don't think that this is the right fix. In C++0x, '<::' (not followed by
':' or '>') is lexed as '<' followed by '::' (see [lex.pptoken]p3 bullet
2, or http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1104).
Implementing that rule (for both C++0x and earlier) seems to me like a
better fit, even though it breaks legal-but-pathological C++98 programs
like this:

int a[42];
#define A(n) a<::##:n:>
int b = A(b);

Richard


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to