public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4229] c++: variadic ttp constraint subsumption [PR99904]
@ 2021-10-07 14:04 Patrick Palka
0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2021-10-07 14:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2e6e0d86a06389056d0e7fecc99c547420ad787a
commit r12-4229-g2e6e0d86a06389056d0e7fecc99c547420ad787a
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Oct 7 10:02:54 2021 -0400
c++: variadic ttp constraint subsumption [PR99904]
Here we're crashing when level-lowering the variadic constraint C<Ts...>
on the template template parameter TT because tsubst_pack_expansion expects
processing_template_decl to be set during a partial substitution.
PR c++/99904
gcc/cp/ChangeLog:
* pt.c (is_compatible_template_arg): Set processing_template_decl
around tsubst_constraint_info.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-ttp4.C: New test.
Diff:
---
gcc/cp/pt.c | 2 ++
gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 19e03369ffa..1e52aa757e1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8230,8 +8230,10 @@ is_compatible_template_arg (tree parm, tree arg)
{
tree aparms = DECL_INNERMOST_TEMPLATE_PARMS (arg);
new_args = template_parms_level_to_args (aparms);
+ ++processing_template_decl;
parm_cons = tsubst_constraint_info (parm_cons, new_args,
tf_none, NULL_TREE);
+ --processing_template_decl;
if (parm_cons == error_mark_node)
return false;
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C
new file mode 100644
index 00000000000..cf3e71ea974
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-ttp4.C
@@ -0,0 +1,9 @@
+// PR c++/99904
+// { dg-do compile { target c++20 } }
+
+template<class... Ts> concept C = (Ts::value && ...);
+template<class... Ts> requires C<Ts...> struct A;
+template<class T> requires true struct B;
+template<template<class... Ts> requires C<Ts...> class TT> struct S;
+using ty1 = S<A>;
+using ty2 = S<B>; // { dg-error "constraint" } TT's constraints don't subsume B's
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-07 14:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 14:04 [gcc r12-4229] c++: variadic ttp constraint subsumption [PR99904] 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).