http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47634
Summary: Incorrect checking of attribute format printf on constructor of derived class with virtual base Product: gcc Version: 4.4.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: d...@randomdan.homeip.net Given the below code, gcc produces the following warnings: exception.cpp: In function 'int main(int, char**)': exception.cpp:28: warning: format not a string literal and no format arguments Changing the __attribute__ on VDerived's constructor to be the same as Derived produces the following error: exception.cpp:9: error: format string argument not a string type Compiled simply with: g++ exception.cpp class Base { public: Base() { } }; class VDerived : public virtual Base { public: VDerived(int x, const char * f, ...) __attribute__((format(printf, 5, 6))); }; class Derived : public Base { public: Derived(int x, const char * f, ...) __attribute__((format(printf, 3, 4))); }; VDerived::VDerived(int x, const char * f, ...) { } Derived::Derived(int x, const char * f, ...) { } int main(int, char **) { throw VDerived(1, "%s %d", "foo", 1); throw Derived(1, "%s %d", "bar", 1); }