From: Ville Voutilainen Date: Sat, 26 Oct 2019 17:32:24 +0000 (+0300) Subject: re PR c++/85254 (boost::is_final does not work for template types) X-Git-Tag: releases/gcc-9.3.0~469 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a90af601e706fe6ef36e42a73ca33bf69258a2a7;p=thirdparty%2Fgcc.git re PR c++/85254 (boost::is_final does not work for template types) PR c++/85254 Backport from mainline 2019-06-01 Ville Voutilainen PR c++/85254 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL. From-SVN: r277474 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8f801de7560c..e0224a0c421f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2018-10-26 Ville Voutilainen + + Backport from mainline + + 2019-06-01 Ville Voutilainen + + PR c++/85254 + * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL. + 2019-10-24 Marek Polacek * decl.c (reshape_init_r): Add missing space. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b3b06eca3747..f7059fb7341b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1907,6 +1907,7 @@ fixup_type_variants (tree t) = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t); TYPE_POLYMORPHIC_P (variants) = TYPE_POLYMORPHIC_P (t); + CLASSTYPE_FINAL (variants) = CLASSTYPE_FINAL (t); TYPE_BINFO (variants) = TYPE_BINFO (t); diff --git a/gcc/testsuite/g++.dg/ext/is_final.C b/gcc/testsuite/g++.dg/ext/is_final.C index b3875ad04aec..20e5d629ff5c 100644 --- a/gcc/testsuite/g++.dg/ext/is_final.C +++ b/gcc/testsuite/g++.dg/ext/is_final.C @@ -43,3 +43,17 @@ static_assert( __is_final (Ff), "Ff is final" ); static_assert( __is_final (Ff), "Ff is final" ); static_assert( __is_final (Ff), "Ff is final" ); +// PR 85254 + +template struct final_trait_wrap{ typedef T type; }; + +template struct my_is_final +{ + static const bool value = __is_final(typename final_trait_wrap::type); +}; + +struct final1 final {}; +template struct final2 final {}; + +static_assert( my_is_final::value, "final1 is final" ); +static_assert( my_is_final>::value, "final2 is final" );