> This line seems wrongly indented, should be only two spaces more > than the if line: > > if (check_for_bare_parameter_packs (expression)) > expression = error_mark_node; > > > The patch LGTM otherwise, thanks.
Thanks for your reply! The wrongly indented line has been fixed. Please check the new patch. -- 8< -- Here an unexpanded parameter pack pass into asm_operand which doesn't expect to see an operand without type. So use check_for_bare_parameter_packs to remedy that. gcc/cp/ChangeLog: * parser.cc (cp_parser_asm_operand_list): Check for unexpanded parameter packs. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-crash7.C: New test. --- gcc/cp/parser.cc | 3 +++ gcc/testsuite/g++.dg/cpp0x/variadic-crash7.C | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-crash7.C diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 86337635f48..cf379088ec4 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -30421,6 +30421,9 @@ cp_parser_asm_operand_list (cp_parser* parser) parens.require_open (parser); /* Parse the expression. */ tree expression = cp_parser_expression (parser); + if (check_for_bare_parameter_packs (expression)) + expression = error_mark_node; + /* Look for the `)'. */ parens.require_close (parser); diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-crash7.C b/gcc/testsuite/g++.dg/cpp0x/variadic-crash7.C new file mode 100644 index 00000000000..b416508160e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-crash7.C @@ -0,0 +1,12 @@ +// { dg-do compile { target c++11 } } + +template <typename... Ts> +void f (Ts&&... args) +{ + asm volatile ("" :: "r"(args) : "memory"); // { dg-error "parameter packs" } +} + +void g() +{ + f(1); +} -- 2.43.0