[Bug c++/69375] GCC allows PMF type "void (T::*)()" to be caught as "void (T::*)() const"
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jan 13 21:08:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69375
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Component|libstdc++ |c++
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
When compiled with clang the pointees are different, so the match fails when
comparing them.
Using Clang:
(gdb) step
__cxxabiv1::__pbase_type_info::__pointer_catch (this=0x401cc0 <typeinfo for
void (A::*)() const>, thrown_type=0x401d10 <typeinfo for void (A::*)()>,
thr_obj=0x7fffffffd220, outer=0)
at
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/cxxabi.h:309
(gdb) step
std::type_info::__do_catch (this=0x401c90 <typeinfo for void () const>,
thr_type=0x401cf8 <typeinfo for void ()>) at
../../../../libstdc++-v3/libsupc++/tinfo.cc:71
(gdb) p *this
$3 = {_vptr.type_info = 0x6030b0 <vtable for
__cxxabiv1::__function_type_info@@CXXABI_1.3+16>, __name = 0x401c89 <typeinfo
name for void () const> "KFvvE"}
(gdb) p *thr_type
$4 = {_vptr.type_info = 0x6030b0 <vtable for
__cxxabiv1::__function_type_info@@CXXABI_1.3+16>, __name = 0x401cf0 <typeinfo
name for void ()> "FvvE"}
(gdb)
But using GCC the two pointee types are the same:
(gdb) p *this
$1 = {_vptr.type_info = 0x6030e8 <vtable for
__cxxabiv1::__function_type_info@@CXXABI_1.3+16>, __name = 0x401c50 <typeinfo
name for void ()> "FvvE"}
(gdb) p *thr_type
$2 = {_vptr.type_info = 0x6030e8 <vtable for
__cxxabiv1::__function_type_info@@CXXABI_1.3+16>, __name = 0x401c50 <typeinfo
name for void ()> "FvvE"}
So it looks like the problem is in the front-end where the typeinfo object for
a pointer to cv-qualified member function has the wrong pointee type.
More information about the Gcc-bugs
mailing list