public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "richard-gccbugzilla at metafoo dot co.uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67772] New: wrong type_info emitted for cv-qualified pointer to member types Date: Wed, 30 Sep 2015 00:46:00 -0000 [thread overview] Message-ID: <bug-67772-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67772 Bug ID: 67772 Summary: wrong type_info emitted for cv-qualified pointer to member types Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: richard-gccbugzilla at metafoo dot co.uk Target Milestone: --- Consider: namespace std { struct type_info {}; } struct A {}; auto x = typeid(void(A::*)() const); Clang emits the type info as: _ZTIM1AKFvvE: .quad _ZTVN10__cxxabiv129__pointer_to_member_type_infoE+16 .quad _ZTSM1AKFvvE .long 0 # 0x0 .zero 4 .quad _ZTIKFvvE .quad _ZTI1A GCC emits it as: _ZTIM1AKFvvE: .quad _ZTVN10__cxxabiv129__pointer_to_member_type_infoE+16 .quad _ZTSM1AKFvvE .long 0 .zero 4 .quad _ZTIFvvE .quad _ZTI1A It appears that Clang is correct here; the 'const' in this case is not a qualifier, so should not be removed when forming the pointee type_info. If GCC really did think this was a const qualifier applied to a function type, it would be emitting the wrong flags (should be .long 1, not .long 0 in that case). This translates into a wrong-code bug in a case like this: struct A; extern "C" void puts(const char*); int main() { try { throw (void(A::*)())0; } catch (void (A::*)() const) { puts("bad catch"); } } ... where GCC erroneously catches a pointer to non-const member function as a pointer to const member function.
next reply other threads:[~2015-09-30 0:46 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-30 0:46 richard-gccbugzilla at metafoo dot co.uk [this message] 2021-08-09 21:00 ` [Bug c++/67772] " pinskia at gcc dot gnu.org 2021-08-09 21:02 ` pinskia 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-67772-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).