--- gcc/cp/lex.c 2018/04/24 18:33:23 1.1.1.3 +++ gcc/cp/lex.c 2018/04/24 18:43:28 1.1.1.4 @@ -3381,7 +3381,12 @@ real_yylex () && DECL_INITIAL (tmp) != NULL_TREE && TREE_CODE (DECL_INITIAL (tmp)) == STRING_CST) { - yylval.ttype = DECL_INITIAL (tmp); + tree stringval = DECL_INITIAL (tmp); + + /* Copy the string value so that we won't clobber anything + if we put something in the TREE_CHAIN of this one. */ + yylval.ttype = build_string (TREE_STRING_LENGTH (stringval), + TREE_STRING_POINTER (stringval)); value = STRING; } }