https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106446
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- The compiler doesn't know what D2::is_me() might return so it must emit code for both branches in bar(). In the true branch, because struct D1 has no member val, the warning triggers. This is by design.