Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/constexpr-typeid4.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++17 } } // Test typeid in a template. #include <typeinfo> struct B { virtual void f(); }; struct B2 : B { }; template<typename T> constexpr bool fn () { constexpr B2 b2; static_assert(&typeid(b2) == &typeid(B2)); // { dg-error ".typeid. is not a constant expression because .b2. is of polymorphic type|non-constant condition" "" { target c++17_down } } return true; } static_assert (fn<int>());