aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2025-04-10 15:49:12 -0400
committerPatrick Palka <ppalka@redhat.com>2025-04-10 15:49:12 -0400
commit493974aa0ad8b94dbeb61f00d2acc57c94fd4809 (patch)
tree3d5632edbd2cd73c05137bd4a486f25fd3e56ddc /gcc
parent1f32b87117b0e2ecc33b844d929d723de3fe8085 (diff)
downloadgcc-493974aa0ad8b94dbeb61f00d2acc57c94fd4809.zip
gcc-493974aa0ad8b94dbeb61f00d2acc57c94fd4809.tar.gz
gcc-493974aa0ad8b94dbeb61f00d2acc57c94fd4809.tar.bz2
c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687]
With inherited CTAD the set of guides may be a two-dimensional overload set (i.e. OVERLOADs of OVERLOADs) so alias_ctad_tweaks (which also does the inherited CTAD transformation) needs to use the 2D-aware lkp_iterator instead of ovl_iterator, or better yet use the more idiomatic lkp_range. PR c++/119687 gcc/cp/ChangeLog: * pt.cc (alias_ctad_tweaks): Use lkp_range / lkp_iterator instead of ovl_iterator. gcc/testsuite/ChangeLog: * g++.dg/cpp23/class-deduction-inherited8.C: New test. Reviewed-by: Jason Merill <jason@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/pt.cc3
-rw-r--r--gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C21
2 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 63c2ec0..805b274 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -30936,9 +30936,8 @@ alias_ctad_tweaks (tree tmpl, tree uguides)
tree aguides = NULL_TREE;
tree atparms = INNERMOST_TEMPLATE_PARMS (fullatparms);
unsigned natparms = TREE_VEC_LENGTH (atparms);
- for (ovl_iterator iter (uguides); iter; ++iter)
+ for (tree f : lkp_range (uguides))
{
- tree f = *iter;
tree in_decl = f;
location_t loc = DECL_SOURCE_LOCATION (f);
tree ret = TREE_TYPE (TREE_TYPE (f));
diff --git a/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C
new file mode 100644
index 0000000..4494c70
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C
@@ -0,0 +1,21 @@
+// PR c++/119687
+// { dg-do compile { target c++17 } }
+
+template <typename> class QFlagsStorage{};
+
+template <typename Enum> struct QFlagsStorageHelper : QFlagsStorage<Enum> {
+ using QFlagsStorage<Enum>::QFlagsStorage;
+
+public:
+ QFlagsStorageHelper(Enum);
+};
+
+template <typename Enum> struct QFlags : public QFlagsStorageHelper<Enum> {
+ using Base = QFlagsStorageHelper<Enum>;
+ using Base::Base;
+ QFlags(Enum);
+};
+
+void f(int flag) {
+ QFlags{int{}};
+}