This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/87862] Different behavior with -O2 with template specialization of virtual member function
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 02 Nov 2018 13:39:06 +0000
- Subject: [Bug c++/87862] Different behavior with -O2 with template specialization of virtual member function
- Auto-submitted: auto-generated
- References: <bug-87862-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87862
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This looks like undefined behaviour. You have a template specialization in
s.cpp but none of the other files can see that specialization exists, and so
they implicitly instantiate t<z::e>::get_b based on the primary template, which
returns a null pointer, which you dereference.