[Bug c++/107615] Segfault on accessing to methods of optional class through member pointer

socurahlem at yandex dot ru gcc-bugzilla@gcc.gnu.org
Thu Nov 10 16:53:11 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107615

--- Comment #3 from Danil Kolotushkin <socurahlem at yandex dot ru> ---
Oh, sorry!
Pointers to the members are a bit confusing for me. Interestingly, previous
versions of gcc and clang work fine in that case. I added more fields to the
object, and it seems that they are by default pointing to the first member
which has this type. With the first type different (for example integer) clang
works fine, but doesn't print anything and gcc exits with segfault. Quite
interesting.

Thank you very much for your answer, Andrew! :)


More information about the Gcc-bugs mailing list