From: Paolo Carlini Date: Wed, 14 Feb 2018 17:59:29 +0000 (+0000) Subject: re PR c++/84350 (ICE with new and auto) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2482a4ec1e7bef28c603c93780de798a027eb9d4;p=gcc.git re PR c++/84350 (ICE with new and auto) /cp 2018-02-14 Paolo Carlini PR c++/84350 * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null init, early return. /testsuite 2018-02-14 Paolo Carlini PR c++/84350 * g++.dg/cpp0x/auto49.C: New. From-SVN: r257666 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 673d6e32453..6c95dfe3a62 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-14 Paolo Carlini + + PR c++/84350 + * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null + init, early return. + 2018-02-14 Nathan Sidwell * decl2.c (mark_vtable_entries): Set input_location to decl's. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e62e320fe31..3ac7adba00c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25975,7 +25975,7 @@ do_auto_deduction (tree type, tree init, tree auto_node, /* C++17 class template argument deduction. */ return do_class_deduction (type, tmpl, init, flags, complain); - if (TREE_TYPE (init) == NULL_TREE) + if (init == NULL_TREE || TREE_TYPE (init) == NULL_TREE) /* Nothing we can do with this, even in deduction context. */ return type; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fb11dfa011..7b6ba1d7336 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-14 Paolo Carlini + + PR c++/84350 + * g++.dg/cpp0x/auto49.C: New. + 2018-02-14 Nathan Sidwell * g++.dg/template/instantiate5.C: Adjust required-from loc. diff --git a/gcc/testsuite/g++.dg/cpp0x/auto49.C b/gcc/testsuite/g++.dg/cpp0x/auto49.C new file mode 100644 index 00000000000..25b09dfdec1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto49.C @@ -0,0 +1,12 @@ +// PR c++/84350 +// { dg-do compile { target c++11 } } + +template void foo(T... t) +{ + new auto(t...); // { dg-error "invalid use" } +} + +void bar() +{ + foo(); +}