aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/lex.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 332efa3..840bad3 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/54526 (again)
+ * lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.
+
2013-01-03 Marc Glisse <marc.glisse@inria.fr>
PR bootstrap/50177
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 23809bc..866bb11 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1,6 +1,6 @@
/* CPP Library - lexical analysis.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
- 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007-2013
+ Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -2290,6 +2290,17 @@ _cpp_lex_direct (cpp_reader *pfile)
{
if (*buffer->cur == ':')
{
+ /* C++11 [2.5/3 lex.pptoken], "Otherwise, if the next
+ three characters are <:: and the subsequent character
+ is neither : nor >, the < is treated as a preprocessor
+ token by itself". */
+ if (CPP_OPTION (pfile, cplusplus)
+ && (CPP_OPTION (pfile, lang) == CLK_CXX11
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX11)
+ && buffer->cur[1] == ':'
+ && buffer->cur[2] != ':' && buffer->cur[2] != '>')
+ break;
+
buffer->cur++;
result->flags |= DIGRAPH;
result->type = CPP_OPEN_SQUARE;