diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/include/cpplib.h | 1 | ||||
-rw-r--r-- | libcpp/lex.cc | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 5746aac..c62374d 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -200,6 +200,7 @@ struct GTY(()) cpp_string { #define DECIMAL_INT (1 << 6) /* Decimal integer, set in c-lex.cc. */ #define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend, set in c-lex.cc. */ +#define COLON_SCOPE PURE_ZERO /* Adjacent colons in C < 23. */ #define SP_DIGRAPH (1 << 8) /* # or ## token was a digraph. */ #define SP_PREV_WHITE (1 << 9) /* If whitespace before a ## operator, or before this token diff --git a/libcpp/lex.cc b/libcpp/lex.cc index 5aa3799..c9e44e6 100644 --- a/libcpp/lex.cc +++ b/libcpp/lex.cc @@ -4235,8 +4235,13 @@ _cpp_lex_direct (cpp_reader *pfile) case ':': result->type = CPP_COLON; - if (*buffer->cur == ':' && CPP_OPTION (pfile, scope)) - buffer->cur++, result->type = CPP_SCOPE; + if (*buffer->cur == ':') + { + if (CPP_OPTION (pfile, scope)) + buffer->cur++, result->type = CPP_SCOPE; + else + result->flags |= COLON_SCOPE; + } else if (*buffer->cur == '>' && CPP_OPTION (pfile, digraphs)) { buffer->cur++; |