[Bug middle-end/105849] A couple of new clang warnings

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 6 13:59:35 GMT 2022


--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
N.B. the finalize<int_range<1>> function is correct. The Clang warning is
saying "this class is not final, so the dynamic type might be different from
the static type" (in which case we would have UB) but that is not actually the
case here. It's correct by construction, because the finalize function is
instantiated for the type being allocated, so the static type matches the
dynamic type.

By making value_range_equiv final, we enforce that the static type is the same
as the dynamic type, by forbidding derivation from that type.

More information about the Gcc-bugs mailing list