c++: constexpr virtual and vbase thunk
authorJason Merrill <jason@redhat.com>
Wed, 10 Nov 2021 21:42:04 +0000 (16:42 -0500)
committerJason Merrill <jason@redhat.com>
Mon, 15 Nov 2021 07:30:26 +0000 (02:30 -0500)
commit267318a2857a42922c3ca033dac4690172b17683
tree4ea96e675ff964d102e803ef0466151b09c5dd73
parentadcfd2c45c3523d74279b5fcac1d7c6c34dd1382
c++: constexpr virtual and vbase thunk

C++20 allows virtual functions to be constexpr.  I don't think that calling
through a pointer to a vbase subobject is supposed to work in a constant
expression, since an object with virtual bases can't be constant, but the
call shouldn't ICE.

gcc/cp/ChangeLog:

* constexpr.c (cxx_eval_thunk_call): Error instead of ICE
on vbase thunk to constexpr function.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-virtual20.C: New test.
gcc/cp/constexpr.c
gcc/testsuite/g++.dg/cpp2a/constexpr-virtual20.C [new file with mode: 0644]