* [pushed] c++: ICE with alias in pack expansion [PR103769]
@ 2022-03-28 13:30 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-03-28 13:30 UTC (permalink / raw)
To: gcc-patches
This was breaking because when we stripped the 't' typedef in s<t<Args>...>
to be s<Args...>, the TYPE_MAIN_VARIANT of "Args..." was still
"t<Args>...", because type pack expansions are treated as types. Fixed by
using the right function to copy a "type".
Tested x86_64-pc-linux-gnu, applying to trunk.
PR c++/99445
PR c++/103769
gcc/cp/ChangeLog:
* tree.cc (strip_typedefs): Use build_distinct_type_copy.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/variadic-alias5.C: New test.
---
gcc/cp/tree.cc | 2 +-
gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index eb59e56610b..492921721f2 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -1791,7 +1791,7 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags)
Ts pack, resulting in an error. */
if (type != pat && uses_parameter_packs (type))
{
- result = copy_node (t);
+ result = build_distinct_type_copy (t);
PACK_EXPANSION_PATTERN (result) = type;
}
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C b/gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C
new file mode 100644
index 00000000000..70956c91838
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-alias5.C
@@ -0,0 +1,9 @@
+// PR c++/103769
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "--param=hash-table-verification-limit=1000" }
+
+template <typename T> using t = T;
+template <typename...> struct s {};
+template <typename...Args> s<t<Args>...> f() { return {};}
+
+int main() { f<void>(); }
base-commit: bc86a86a4f2c057bc0e0be94dcbb8c128ae7f717
--
2.27.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-28 13:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 13:30 [pushed] c++: ICE with alias in pack expansion [PR103769] Jason Merrill
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).