Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic12.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line source
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr. // { dg-do compile { target c++2a } } // dynamic_cast in a destructor. struct A2 { virtual void a2(); }; struct A : A2 { virtual void a(); }; struct C2 { virtual void c2(); }; struct B : A, C2 { constexpr ~B(); }; constexpr B::~B() { A *a = dynamic_cast<A*>((C2*)this); if (a != (A*) this) __builtin_abort (); A& ar = dynamic_cast<A&>((C2&)*this); if (&ar != &(A&)*this) __builtin_abort (); } struct D : B { virtual void d(); }; constexpr D d;