[clang] [clang] When checking for covariant return types, make sure the poiners or references are to *classes* (PR #111856)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 11 07:10:27 PDT 2024


cor3ntin wrote:

>  CC @AaronBallman @cor3ntin Do we want to make this a warning that defaults to an error instead? Imo it’s probably fine as-is because I don’t imagine too many people would write code that abuses us not diagnosing this...

It looks fine to me as is.

Code that would do something like `static_cast<BaseReturnType>(derived->f())` (which I think is perfectly reasonable)  would explode, despite the standard guarantees it should work.

If people scream we have plenty of time to reconsider making it a warning



https://github.com/llvm/llvm-project/pull/111856


More information about the cfe-commits mailing list