From: Jason Merrill Date: Mon, 20 Feb 2017 06:06:39 +0000 (-0500) Subject: PR c++/78282 - auto template and pack expansion X-Git-Tag: upstream/12.2.0~41086 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f712b76904c9e495d16817fa93f8edde4c1f0cd;p=platform%2Fupstream%2Fgcc.git PR c++/78282 - auto template and pack expansion * pt.c (find_parameter_packs_r): Don't walk into the type of templates other than template template-parameters. From-SVN: r245594 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7258348..b5def8c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-02-19 Jason Merrill + PR c++/78282 - auto template and pack expansion + * pt.c (find_parameter_packs_r): Don't walk into the type of + templates other than template template-parameters. + PR c++/79606 - ICE with this->base_member in NSDMI * class.c (build_base_path): Check processing_template_decl. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0a9f5d5..2cac24f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3576,8 +3576,12 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) *walk_subtrees = 0; return NULL_TREE; - case CONSTRUCTOR: case TEMPLATE_DECL: + if (!DECL_TEMPLATE_TEMPLATE_PARM_P (t)) + return NULL_TREE; + gcc_fallthrough(); + + case CONSTRUCTOR: cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, ppd->visited); return NULL_TREE; diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn36.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn36.C new file mode 100644 index 0000000..f89c092 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn36.C @@ -0,0 +1,26 @@ +// PR c++/78282 +// { dg-do compile { target c++14 } } + +struct null_node +{ + null_node(const null_node&); +}; + +extern null_node null; + +template +auto get() { return null; } + +template +struct inheritor: Ts... +{ + inheritor(const inheritor& outer) + : Ts(get())... + { } +}; + +void test() +{ + extern inheritor example; + inheritor result(example); +}