public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dan at randomdan dot homeip.net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/47634] New: Incorrect checking of attribute format printf on constructor of derived class with virtual base Date: Mon, 07 Feb 2011 14:50:00 -0000 [thread overview] Message-ID: <bug-47634-4@http.gcc.gnu.org/bugzilla/> (raw) 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: unassigned@gcc.gnu.org ReportedBy: dan@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); }
next reply other threads:[~2011-02-07 14:37 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-02-07 14:50 dan at randomdan dot homeip.net [this message] 2021-08-09 18:26 ` [Bug c++/47634] " pinskia at gcc dot gnu.org 2022-03-31 22:37 ` mpolacek at gcc dot gnu.org 2022-05-07 14:44 ` cvs-commit at gcc dot gnu.org 2022-05-07 14:59 ` mpolacek at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-47634-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).