summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@marvell.com>2019-05-20 06:59:06 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2019-05-19 23:59:06 -0700
commit3f23e487f38e56a3daa66ad22dc2216fa17db885 (patch)
tree397fd7d94db61830bbfe735e6f8b5f0846098e48 /libcpp
parent55fd9fcd83baa4034d6a5e4a0ad6527c69b94668 (diff)
[PATCH] Fix PR 81721: ICE with PCH and Pragma warning and C++ operator
libcpp/ChangeLog: 2019-05-19 Andrew Pinski <apinski@marvell.com> PR pch/81721 * lex.c (cpp_token_val_index <case SPELL_OPERATOR>): If tok->flags has NAMED_OP set, then return CPP_TOKEN_FLD_NODE. gcc/testsuite/ChangeLog: 2019-05-19 Andrew Pinski <apinski@marvell.com> PR pch/81721 * g++.dg/pch/operator-1.C: New testcase. * g++.dg/pch/operator-1.Hs: New file. From-SVN: r271395
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/lex.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 317d1bdd208..71a09495440 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-19 Andrew Pinski <apinski@marvell.com>
+
+ PR pch/81721
+ * lex.c (cpp_token_val_index <case SPELL_OPERATOR>): If tok->flags
+ has NAMED_OP set, then return CPP_TOKEN_FLD_NODE.
+
2019-05-14 Martin Liska <mliska@suse.cz>
PR preprocessor/90382
diff --git a/libcpp/lex.c b/libcpp/lex.c
index eedfcbb3146..16ded6e9b05 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -3756,7 +3756,11 @@ cpp_token_val_index (const cpp_token *tok)
case SPELL_LITERAL:
return CPP_TOKEN_FLD_STR;
case SPELL_OPERATOR:
- if (tok->type == CPP_PASTE)
+ /* Operands which were originally spelled as ident keep around
+ the node for the exact spelling. */
+ if (tok->flags & NAMED_OP)
+ return CPP_TOKEN_FLD_NODE;
+ else if (tok->type == CPP_PASTE)
return CPP_TOKEN_FLD_TOKEN_NO;
else
return CPP_TOKEN_FLD_NONE;