https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82008
Bug ID: 82008 Summary: nonnull attribute and multiple inheritance Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joerg.rich...@pdv-fs.de Target Milestone: --- cat > t.cc << EOF struct Base1 { char s; }; struct Base2 { char x; }; struct Deriv : Base1, Base2 {}; void funcyyy( Base2* ) __attribute__((nonnull)); void funcxxx( Deriv* d ) { funcyyy( d ); } EOF g++ -c t.cc -o t.o -Wall template.cc: In function 'void funcxxx(Deriv*)': template.cc:18:14: warning: null argument where non-null required (argument 1) [-Wnonnull] funcyyy( d ); If funcyyy is declared as taking Base1* it works without warning.