diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/auto-fn36.C | 26 |
3 files changed, 35 insertions, 1 deletions
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 <jason@redhat.com> + 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 <typename T> +auto get() { return null; } + +template <typename... Ts> +struct inheritor: Ts... +{ + inheritor(const inheritor& outer) + : Ts(get<Ts...>())... + { } +}; + +void test() +{ + extern inheritor<null_node> example; + inheritor<null_node> result(example); +} |