From: Jason Merrill Date: Thu, 5 Apr 2018 00:09:05 +0000 (-0400) Subject: PR c++/84936 - ICE with unexpanded pack in mem-initializer. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0dd285f9a8da75fd01a36acb6b427a9afbd189ce;p=gcc.git PR c++/84936 - ICE with unexpanded pack in mem-initializer. * parser.c (cp_parser_mem_initializer_list): Call check_for_bare_parameter_packs. From-SVN: r259107 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a691763669f..62f61eab345 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-04-04 Jason Merrill + + PR c++/84936 - ICE with unexpanded pack in mem-initializer. + * parser.c (cp_parser_mem_initializer_list): Call + check_for_bare_parameter_packs. + 2018-04-04 Jakub Jelinek PR inline-asm/85172 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f6fbcf6185e..59eb8226112 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14381,10 +14381,15 @@ cp_parser_mem_initializer_list (cp_parser* parser) /* Parse the mem-initializer. */ mem_initializer = cp_parser_mem_initializer (parser); /* If the next token is a `...', we're expanding member initializers. */ - if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)) + bool ellipsis = cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS); + if (ellipsis + || (mem_initializer != error_mark_node + && check_for_bare_parameter_packs (TREE_PURPOSE + (mem_initializer)))) { /* Consume the `...'. */ - cp_lexer_consume_token (parser->lexer); + if (ellipsis) + cp_lexer_consume_token (parser->lexer); /* The TREE_PURPOSE must be a _TYPE, because base-specifiers can be expanded but members cannot. */ diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic175.C b/gcc/testsuite/g++.dg/cpp0x/variadic175.C new file mode 100644 index 00000000000..969f4b0b152 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic175.C @@ -0,0 +1,10 @@ +// PR c++/84936 +// { dg-do compile { target c++11 } } + +struct A +{ + template A(T... t) + : decltype(t)() {} // { dg-error "parameter pack" } +}; + +A a;