From: Ville Voutilainen Date: Sat, 1 Jun 2019 10:57:12 +0000 (+0300) Subject: re PR c++/85254 (boost::is_final does not work for template types) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8a20d031eabab786350d5cbced44f907301e6c8b;p=gcc.git re PR c++/85254 (boost::is_final does not work for template types) PR c++/85254 gcc/cp PR c++/85254 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL. testsuite/ PR c++/85254 * g++.dg/ext/is_final.C: Amend. From-SVN: r271835 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d05719b9bbe..b88976bb818 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2019-06-01 Ville Voutilainen + + gcc/cp + + PR c++/85254 + * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL. + + testsuite/ + + PR c++/85254 + * g++.dg/ext/is_final.C: Amend. + 2019-05-31 Nathan Sidwell * cp-tree.h (IDENTIFIER_LAMBDA_P): New. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index a2585a61f96..d6ac6ce5c9a 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 b3875ad04ae..20e5d629ff5 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" );