https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125634
Bug ID: 125634
Summary: typeid on glvalue with final class type does not
evaluate the expression
Product: gcc
Version: 12.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mital at mitalashok dot co.uk
Target Milestone: ---
This program:
#include <typeinfo>
struct X final {
virtual ~X() = default;
};
int main() {
int i = 1;
X x;
(void)typeid((i = 0, x));
return i;
}
Incorrectly outputs 1 in GCC10 and above.
If we modify gcc/testsuite/g++.dg/cpp2a/constexpr-typeid1.C to make D final, it
also doesn't pass: <https://godbolt.org/z/xo87MqKvE>