public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6949] c++: CONSTRUCTORs are non-deduced contexts [PR104291]
@ 2022-01-31 19:15 Patrick Palka
  0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2022-01-31 19:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0eb06ee9a40a09d2f492461289d69aa39f757e66

commit r12-6949-g0eb06ee9a40a09d2f492461289d69aa39f757e66
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Jan 31 14:15:01 2022 -0500

    c++: CONSTRUCTORs are non-deduced contexts [PR104291]
    
            PR c++/104291
    
    gcc/cp/ChangeLog:
    
            * pt.cc (for_each_template_parm_r) <case CONSTRUCTOR>: Clear
            walk_subtrees if !include_nondeduced_p.  Simplify given that
            cp_walk_subtrees already walks TYPE_PTRMEMFUNC_FN_TYPE_RAW.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/template/partial20.C: New test.

Diff:
---
 gcc/cp/pt.cc                              | 7 +------
 gcc/testsuite/g++.dg/template/partial20.C | 7 +++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index f46a7ad6655..84d63f9181c 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -10525,12 +10525,6 @@ for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d)
       *walk_subtrees = 0;
       break;
 
-    case CONSTRUCTOR:
-      if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))
-	  && pfd->include_nondeduced_p)
-	WALK_SUBTREE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)));
-      break;
-
     case INDIRECT_REF:
     case COMPONENT_REF:
       /* If there's no type, then this thing must be some expression
@@ -10539,6 +10533,7 @@ for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d)
 	return error_mark_node;
       break;
 
+    case CONSTRUCTOR:
     case TRAIT_EXPR:
     case PLUS_EXPR:
     case MULT_EXPR:
diff --git a/gcc/testsuite/g++.dg/template/partial20.C b/gcc/testsuite/g++.dg/template/partial20.C
new file mode 100644
index 00000000000..b29e09988d9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial20.C
@@ -0,0 +1,7 @@
+// PR c++/104291
+// { dg-do compile { target c++20 } }
+
+struct A { int x; };
+
+template<auto> struct B;
+template<int N> struct B<A{N}> { }; // { dg-error "not deducible" }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-31 19:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 19:15 [gcc r12-6949] c++: CONSTRUCTORs are non-deduced contexts [PR104291] Patrick Palka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).