https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122705

--- Comment #8 from Alejandro Colomar <[email protected]> ---
(In reply to Alejandro Colomar from comment #6)
> (In reply to Andrew Pinski from comment #5)
> > Exposing this might be useful but it might also get abused incorrectly ...

I think the compiler, especially with -fanalyzer (which is essentially where
this attribute would be useful), would be able to verify the implementation to
check if all paths return a derived pointer (or null pointer) or not.  If it
can't verify because certain paths are invisible (i.e., other TUs and not
marked with the same attribute) to the compiler, or if it finds non-derived
pointers, it should diagnose.

Reply via email to