public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-8090] c++: alias template of non-template class [PR112633]
@ 2023-11-23 0:08 Patrick Palka
0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2023-11-23 0:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:63c65224e778124eee52acc7b9fcb32cd8ad61e8
commit r13-8090-g63c65224e778124eee52acc7b9fcb32cd8ad61e8
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Nov 22 19:07:19 2023 -0500
c++: alias template of non-template class [PR112633]
The entering_scope adjustment in tsubst_aggr_type assumes if an alias is
dependent, then so is the aliased type (and therefore it has template info)
but that's not true for the dependent alias template specialization ty1<T>
below which aliases the non-template class A. In this case no adjustment
is needed anyway, so we can just punt.
PR c++/112633
gcc/cp/ChangeLog:
* pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO
in the entering_scope adjustment.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-75.C: New test.
(cherry picked from commit 3f266c84a15d63e42bfad46397fea9aff92b0720)
Diff:
---
gcc/cp/pt.cc | 1 +
gcc/testsuite/g++.dg/cpp0x/alias-decl-75.C | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 174567fc1ec..761df45f274 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -14003,6 +14003,7 @@ tsubst_aggr_type (tree t,
if (entering_scope
&& CLASS_TYPE_P (t)
&& dependent_type_p (t)
+ && TYPE_TEMPLATE_INFO (t)
&& TYPE_CANONICAL (t) == TREE_TYPE (TYPE_TI_TEMPLATE (t)))
t = TYPE_CANONICAL (t);
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-75.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-75.C
new file mode 100644
index 00000000000..1a73a99856e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-75.C
@@ -0,0 +1,13 @@
+// PR c++/112633
+// { dg-do compile { target c++11 } }
+
+struct A { using type = void; };
+
+template<class>
+using ty1 = A;
+
+template<class T>
+using ty2 = typename ty1<T>::type;
+
+template<class T>
+ty2<T> f();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-23 0:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23 0:08 [gcc r13-8090] c++: alias template of non-template class [PR112633] 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).