As discussed in the 124770 patch. This makes decl_defined_p correct
for more cases.
gcc/cp/ChangeLog:
* decl2.cc (decl_defined_p): Also return true if DECL_INITIAL
and !DECL_IN_AGGR_P is true for a VAR_DECL.
Reviewed-by: Jason Merrill <jason@redhat.com>
else
{
gcc_assert (VAR_P (decl));
- return !DECL_EXTERNAL (decl);
+ return (!DECL_EXTERNAL (decl)
+ /* An initialized variable is defined even if we've decided not
+ to emit it, unless it's initialized within the class and not
+ inline. Note that finish_static_member_decl doesn't set
+ DECL_IN_AGGR_P for inline variables, so we don't need to check
+ DECL_INLINE_VAR_P here. */
+ || (DECL_INITIAL (decl) && !DECL_IN_AGGR_P (decl)));
}
}