public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/93310] Incorrect constexpr virtual evaluation inside a constructor
[not found] <bug-93310-4@http.gcc.gnu.org/bugzilla/>
@ 2020-06-04 4:45 ` jason at gcc dot gnu.org
2020-06-04 19:11 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2020-06-04 4:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93310
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/93310] Incorrect constexpr virtual evaluation inside a constructor
[not found] <bug-93310-4@http.gcc.gnu.org/bugzilla/>
2020-06-04 4:45 ` [Bug c++/93310] Incorrect constexpr virtual evaluation inside a constructor jason at gcc dot gnu.org
@ 2020-06-04 19:11 ` cvs-commit at gcc dot gnu.org
2020-06-04 19:13 ` cvs-commit at gcc dot gnu.org
2020-12-09 14:03 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-04 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93310
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:7ece3bd8088983289731450826c238eb2bdd2db5
commit r11-955-g7ece3bd8088983289731450826c238eb2bdd2db5
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 3 23:50:50 2020 -0400
c++: Fix complex constexpr virtual cases [PR93310].
The code in constexpr for looking up the actual type of the object and then
getting the virtual function from there broke for both of these tests: for
16, it assumed incorrectly that the DECL_VINDEX would apply to the most
derived type's vtable; for 17, it failed to consider that during
construction the base subobject is treated as being of the base type.
Fixed by just doing constant evaluation of the expression that looks up the
function in the vtable. This means that a virtual call will involve
loading
the vptr, so we will reject some calls through non-constexpr variables that
we previously accepted, but this seems appropriate to me. None of our
testcases were affected.
gcc/cp/ChangeLog:
PR c++/93310
* constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
Evaluate OBJ_TYPE_REF_EXPR.
gcc/testsuite/ChangeLog:
PR c++/93310
* g++.dg/cpp2a/constexpr-virtual16.C: New test.
* g++.dg/cpp2a/constexpr-virtual17.C: New test.
* g++.dg/cpp2a/constexpr-new12.C: Adjust diagnostic.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/93310] Incorrect constexpr virtual evaluation inside a constructor
[not found] <bug-93310-4@http.gcc.gnu.org/bugzilla/>
2020-06-04 4:45 ` [Bug c++/93310] Incorrect constexpr virtual evaluation inside a constructor jason at gcc dot gnu.org
2020-06-04 19:11 ` cvs-commit at gcc dot gnu.org
@ 2020-06-04 19:13 ` cvs-commit at gcc dot gnu.org
2020-12-09 14:03 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-04 19:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93310
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:6b45b400c51be06f2d0e37a7b461cbd4ce9fe37d
commit r10-8243-g6b45b400c51be06f2d0e37a7b461cbd4ce9fe37d
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 3 23:50:50 2020 -0400
c++: Fix complex constexpr virtual cases [PR93310].
The code in constexpr for looking up the actual type of the object and then
getting the virtual function from there broke for both of these tests: for
16, it assumed incorrectly that the DECL_VINDEX would apply to the most
derived type's vtable; for 17, it failed to consider that during
construction the base subobject is treated as being of the base type.
Fixed by just doing constant evaluation of the expression that looks up the
function in the vtable. This means that a virtual call will involve
loading
the vptr, so we will reject some calls through non-constexpr variables that
we previously accepted, but this seems appropriate to me. None of our
testcases were affected.
gcc/cp/ChangeLog:
PR c++/93310
* constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
Evaluate OBJ_TYPE_REF_EXPR.
gcc/testsuite/ChangeLog:
PR c++/93310
* g++.dg/cpp2a/constexpr-virtual16.C: New test.
* g++.dg/cpp2a/constexpr-virtual17.C: New test.
* g++.dg/cpp2a/constexpr-new12.C: Adjust diagnostic.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/93310] Incorrect constexpr virtual evaluation inside a constructor
[not found] <bug-93310-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-06-04 19:13 ` cvs-commit at gcc dot gnu.org
@ 2020-12-09 14:03 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2020-12-09 14:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93310
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|--- |10.2
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed in 10.2/11. I doubt anyone is still using GCC 9 for C++20 code.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-09 14:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-93310-4@http.gcc.gnu.org/bugzilla/>
2020-06-04 4:45 ` [Bug c++/93310] Incorrect constexpr virtual evaluation inside a constructor jason at gcc dot gnu.org
2020-06-04 19:11 ` cvs-commit at gcc dot gnu.org
2020-06-04 19:13 ` cvs-commit at gcc dot gnu.org
2020-12-09 14:03 ` jason at gcc dot gnu.org
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).