]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/89966 - error with non-type auto tparm.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Apr 2019 02:50:52 +0000 (02:50 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Apr 2019 02:50:52 +0000 (02:50 +0000)
My patch for PR 86932 broke this testcase by passing tf_partial to
coerce_template_template_parms, which prevented do_auto_deduction from
actually replacing the auto.

* pt.c (do_auto_deduction): Clear tf_partial.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270160 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1z/nontype-auto15.C [new file with mode: 0644]

index 55a083fab6ff1b10ffc3e41c3dae1b12fd74e577..ad4dba46bfe8b55caa187a09316f76d914dfa749 100644 (file)
@@ -1,3 +1,8 @@
+2019-04-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/89966 - error with non-type auto tparm.
+       * pt.c (do_auto_deduction): Clear tf_partial.
+
 2019-04-04  Jason Merrill  <jason@redhat.com>
 
        PR c++/86986 - ICE with TTP with parameter pack.
index 20647be587ac0f706728d76ce2d8c34257bf26ae..40d954d1e8a37451518bb80d4b8f73ea9f798bad 100644 (file)
@@ -27504,6 +27504,10 @@ do_auto_deduction (tree type, tree init, tree auto_node,
   if (init && undeduced_auto_decl (init))
     return type;
 
+  /* We may be doing a partial substitution, but we still want to replace
+     auto_node.  */
+  complain &= ~tf_partial;
+
   if (tree tmpl = CLASS_PLACEHOLDER_TEMPLATE (auto_node))
     /* C++17 class template argument deduction.  */
     return do_class_deduction (type, tmpl, init, flags, complain);
diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto15.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto15.C
new file mode 100644 (file)
index 0000000..d94885d
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/89966
+// { dg-do compile { target c++17 } }
+
+template < auto a0 >
+void f0() { }
+void f0_call() { f0< sizeof(int) >(); }