This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82008] New: nonnull attribute and multiple inheritance


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.richter@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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]