I was mistaken to assume that a dependent type is necessarily
incomplete, and indeed there are multiple places in the frontend where
we check a type for both dependency and completeness. So this patch
partially reverts the fix for PR95497, restoring the dependent_type_p
check that guarded the call to is_really_empty_class below.
gcc/cp/ChangeLog:
PR c++/96132
* constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
Restore dependent_type_p check that guarded the call to
is_really_empty_class.
gcc/testsuite/ChangeLog:
PR c++/96132
* g++.dg/template/incomplete12.C: New test.
{
tree type = TREE_TYPE (t);
if ((processing_template_decl && !COMPLETE_TYPE_P (type))
+ || dependent_type_p (type)
|| is_really_empty_class (type, /*ignore_vptr*/false))
/* An empty class has no data to read. */
return true;
--- /dev/null
+// PR c++/96132
+// { dg-do compile }
+
+template <int> class a;
+
+template <int b> class c {
+ a<b> e;
+ void operator=(c d) { e = d; }
+};