re PR c++/84350 (ICE with new and auto)
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 14 Feb 2018 17:59:29 +0000 (17:59 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 14 Feb 2018 17:59:29 +0000 (17:59 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/auto49.C [new file with mode: 0644]

index 673d6e32453d02653de0ee21ca56fb934308cd1b..6c95dfe3a6209e78445e4b82b2169cf158e4c7d0 100644 (file)
@@ -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.
index e62e320fe31132203c5f42913eaf249fd0d6c1a4..3ac7adba00c97e6a4ea1618873dccebb219eb2e0 100644 (file)
@@ -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;
 
index 4fb11dfa0111a23e3849069db4c27ddaf7aa622e..7b6ba1d733692ee444fda827e7b22ed62de8088d 100644 (file)
@@ -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 (file)
index 0000000..25b09df
--- /dev/null
@@ -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();
+}