aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2023-12-11 09:48:04 -0500
committerPatrick Palka <ppalka@redhat.com>2023-12-11 09:48:04 -0500
commitf5aa23f7f633313039c840ab36695a38efbb1a99 (patch)
treea688c732ca58015f983370d838430b808ac2c94f
parentb1474da1bb9cc829cbf597f9a51393795108419f (diff)
downloadgcc-f5aa23f7f633313039c840ab36695a38efbb1a99.zip
gcc-f5aa23f7f633313039c840ab36695a38efbb1a99.tar.gz
gcc-f5aa23f7f633313039c840ab36695a38efbb1a99.tar.bz2
c++: alias CTAD and specializations table
A rewritten guide for alias CTAD isn't really a specialization of the original guide, so we shouldn't register it as such. This avoids an ICE in the below modules testcase for which we otherwise crash due to the guide's empty DECL_CONTEXT when walking the specializations table. It also preemptively avoids the same ICE in modules/concept-6 in C++23 mode with the inherited CTAD patch. gcc/cp/ChangeLog: * pt.cc (alias_ctad_tweaks): Pass use_spec_table=false to tsubst_decl. gcc/testsuite/ChangeLog: * g++.dg/modules/concept-8.h: New test. * g++.dg/modules/concept-8_a.H: New test. * g++.dg/modules/concept-8_b.C: New test.
-rw-r--r--gcc/cp/pt.cc3
-rw-r--r--gcc/testsuite/g++.dg/modules/concept-8.h14
-rw-r--r--gcc/testsuite/g++.dg/modules/concept-8_a.H5
-rw-r--r--gcc/testsuite/g++.dg/modules/concept-8_b.C8
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index e9dcdb3..208fa21 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -30020,7 +30020,8 @@ alias_ctad_tweaks (tree tmpl, tree uguides)
/* Parms are to have DECL_CHAIN tsubsted, which would be skipped
if cp_unevaluated_operand. */
cp_evaluated ev;
- g = tsubst_decl (DECL_TEMPLATE_RESULT (f), targs, complain);
+ g = tsubst_decl (DECL_TEMPLATE_RESULT (f), targs, complain,
+ /*use_spec_table=*/false);
}
if (g == error_mark_node)
continue;
diff --git a/gcc/testsuite/g++.dg/modules/concept-8.h b/gcc/testsuite/g++.dg/modules/concept-8.h
new file mode 100644
index 0000000..a25f9b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/concept-8.h
@@ -0,0 +1,14 @@
+// A version of concept-6.h using an alias template + alias CTAD
+
+template<typename _Callable>
+struct Base
+{
+ Base (const _Callable &)
+ requires true
+ {}
+};
+
+template<typename _Callable> requires true
+using Derived = Base<_Callable>;
+
+inline Derived all = [] (auto&& __r) {};
diff --git a/gcc/testsuite/g++.dg/modules/concept-8_a.H b/gcc/testsuite/g++.dg/modules/concept-8_a.H
new file mode 100644
index 0000000..da04677
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/concept-8_a.H
@@ -0,0 +1,5 @@
+// { dg-require-effective-target c++20 }
+// { dg-additional-options "-fmodule-header -fconcepts" }
+// { dg-module-cmi {} }
+
+#include "concept-8.h"
diff --git a/gcc/testsuite/g++.dg/modules/concept-8_b.C b/gcc/testsuite/g++.dg/modules/concept-8_b.C
new file mode 100644
index 0000000..9a9f014
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/concept-8_b.C
@@ -0,0 +1,8 @@
+// { dg-require-effective-target c++20 }
+// { dg-additional-options "-fmodules-ts -fconcepts -fdump-lang-module-alias -fno-module-lazy" }
+
+#include "concept-8.h"
+import "concept-8_a.H";
+
+// { dg-final { scan-lang-dump-times {named merge key \(matched\) function_decl:'::Base<::._anon_0>::__ct '} 2 module } }
+// { dg-final { scan-lang-dump-not {merge key \(new\)} module } }