diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 154729c..5e1b67c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4291,7 +4291,16 @@ make_char_string_pack (tree value) /* Fill in CHARVEC with all of the parameters. */ charvec = make_tree_vec (len); for (i = 0; i < len; ++i) - TREE_VEC_ELT (charvec, i) = build_int_cst (char_type_node, str[i]); + { + unsigned char s[3] = { '\'', str[i], '\'' }; + cpp_string in = { 3, s }; + cpp_string out = { 0, 0 }; + if (!cpp_interpret_string (parse_in, &in, 1, &out, CPP_STRING)) + return NULL_TREE; + gcc_assert (out.len == 2); + TREE_VEC_ELT (charvec, i) = build_int_cst (char_type_node, + out.text[0]); + } /* Build the argument packs. */ SET_ARGUMENT_PACK_ARGS (argpack, charvec); @@ -4407,6 +4416,12 @@ cp_parser_userdef_numeric_literal (cp_parser *parser) if (decl && decl != error_mark_node) { tree tmpl_args = make_char_string_pack (num_string); + if (tmpl_args == NULL_TREE) + { + error ("failed to translate literal to execution character set %qT", + num_string); + return error_mark_node; + } decl = lookup_template_function (decl, tmpl_args); result = finish_call_expr (decl, &args, false, true, tf_warning_or_error); |