aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/module.cc26
-rw-r--r--gcc/cp/pt.cc10
3 files changed, 41 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 340552f..b102f17 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,21 @@
+2025-05-15 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/120161
+ * pt.cc (unify) <case RECORD_TYPE>: When comparing specializations
+ of a non-primary template, still perform a type comparison.
+
+2025-05-15 Jason Merrill <jason@redhat.com>
+
+ * module.cc (trees_out::lang_decl_bools): Stream implicit_constexpr.
+ (trees_in::lang_decl_bools): Likewise.
+ (trees_in::is_matching_decl): Check it.
+
+2025-05-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/99599
+ * pt.cc (conversion_may_instantiate_p): Make sure
+ classes are complete.
+
2025-05-14 Ville Voutilainen <ville.voutilainen@gmail.com>
* cp-gimplify.cc (cp_fold): Remove a remnant comment.
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index e778262..4f9c378 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -6024,7 +6024,7 @@ trees_out::lang_decl_bools (tree t, bits_out& bits)
WB (lang->u.fn.has_dependent_explicit_spec_p);
WB (lang->u.fn.immediate_fn_p);
WB (lang->u.fn.maybe_deleted);
- /* We do not stream lang->u.fn.implicit_constexpr. */
+ WB (lang->u.fn.implicit_constexpr);
WB (lang->u.fn.escalated_p);
WB (lang->u.fn.xobj_func);
goto lds_min;
@@ -6095,7 +6095,7 @@ trees_in::lang_decl_bools (tree t, bits_in& bits)
RB (lang->u.fn.has_dependent_explicit_spec_p);
RB (lang->u.fn.immediate_fn_p);
RB (lang->u.fn.maybe_deleted);
- /* We do not stream lang->u.fn.implicit_constexpr. */
+ RB (lang->u.fn.implicit_constexpr);
RB (lang->u.fn.escalated_p);
RB (lang->u.fn.xobj_func);
goto lds_min;
@@ -12193,13 +12193,23 @@ trees_in::is_matching_decl (tree existing, tree decl, bool is_typedef)
/* Similarly if EXISTING has undeduced constexpr, but DECL's
is already deduced. */
- if (DECL_MAYBE_DELETED (e_inner) && !DECL_MAYBE_DELETED (d_inner)
- && DECL_DECLARED_CONSTEXPR_P (d_inner))
- DECL_DECLARED_CONSTEXPR_P (e_inner) = true;
- else if (!DECL_MAYBE_DELETED (e_inner) && DECL_MAYBE_DELETED (d_inner))
- /* Nothing to do. */;
+ if (DECL_DECLARED_CONSTEXPR_P (e_inner)
+ == DECL_DECLARED_CONSTEXPR_P (d_inner))
+ /* Already matches. */;
+ else if (DECL_DECLARED_CONSTEXPR_P (d_inner)
+ && (DECL_MAYBE_DELETED (e_inner)
+ || decl_implicit_constexpr_p (d_inner)))
+ /* DECL was deduced, copy to EXISTING. */
+ {
+ DECL_DECLARED_CONSTEXPR_P (e_inner) = true;
+ if (decl_implicit_constexpr_p (d_inner))
+ DECL_LANG_SPECIFIC (e_inner)->u.fn.implicit_constexpr = true;
+ }
else if (DECL_DECLARED_CONSTEXPR_P (e_inner)
- != DECL_DECLARED_CONSTEXPR_P (d_inner))
+ && (DECL_MAYBE_DELETED (d_inner)
+ || decl_implicit_constexpr_p (e_inner)))
+ /* EXISTING was deduced, leave it alone. */;
+ else
{
mismatch_msg = G_("conflicting %<constexpr%> for imported "
"declaration %#qD");
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 0d64a1c..1973d25 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -23529,13 +23529,13 @@ conversion_may_instantiate_p (tree to, tree from)
/* Converting to a non-aggregate class type will consider its
user-declared constructors, which might induce instantiation. */
- if (CLASS_TYPE_P (to)
+ if (CLASS_TYPE_P (complete_type (to))
&& type_has_converting_constructor (to))
return true;
/* Similarly, converting from a class type will consider its conversion
functions. */
- if (CLASS_TYPE_P (from)
+ if (CLASS_TYPE_P (complete_type (from))
&& TYPE_HAS_CONVERSION (from))
return true;
@@ -25785,10 +25785,10 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (parm)),
INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (t)),
UNIFY_ALLOW_NONE, explain_p);
- else
- return unify_success (explain_p);
+ gcc_checking_assert (t == arg);
}
- else if (!same_type_ignoring_top_level_qualifiers_p (parm, arg))
+
+ if (!same_type_ignoring_top_level_qualifiers_p (parm, arg))
return unify_type_mismatch (explain_p, parm, arg);
return unify_success (explain_p);