aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2018-02-14 17:59:29 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2018-02-14 17:59:29 +0000
commit2482a4ec1e7bef28c603c93780de798a027eb9d4 (patch)
treebb1c91d3e8d5ab2b73ee3c4ca29ccb944e9354b0 /gcc
parent486c529987375143c1ca508a76c751cb07c56324 (diff)
downloadgcc-2482a4ec1e7bef28c603c93780de798a027eb9d4.zip
gcc-2482a4ec1e7bef28c603c93780de798a027eb9d4.tar.gz
gcc-2482a4ec1e7bef28c603c93780de798a027eb9d4.tar.bz2
re PR c++/84350 (ICE with new and auto)
/cp 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com> 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 <paolo.carlini@oracle.com> PR c++/84350 * g++.dg/cpp0x/auto49.C: New. From-SVN: r257666
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto49.C12
4 files changed, 24 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 673d6e3..6c95dfe 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ 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 <nathan@acm.org>
* decl2.c (mark_vtable_entries): Set input_location to decl's.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e62e320..3ac7adb 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 4fb11df..7b6ba1d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/84350
+ * g++.dg/cpp0x/auto49.C: New.
+
2018-02-14 Nathan Sidwell <nathan@acm.org>
* 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 0000000..25b09df
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto49.C
@@ -0,0 +1,12 @@
+// PR c++/84350
+// { dg-do compile { target c++11 } }
+
+template<typename... T> void foo(T... t)
+{
+ new auto(t...); // { dg-error "invalid use" }
+}
+
+void bar()
+{
+ foo();
+}