diff options
author | Ville Voutilainen <ville.voutilainen@gmail.com> | 2019-06-01 13:57:12 +0300 |
---|---|---|
committer | Ville Voutilainen <ville@gcc.gnu.org> | 2019-06-01 13:57:12 +0300 |
commit | 8a20d031eabab786350d5cbced44f907301e6c8b (patch) | |
tree | e37f8272f651f9bfc88515396a469e2b9f93db75 | |
parent | ceedc63594bfda6122690ee2bd6976c93bec7527 (diff) | |
download | gcc-8a20d031eabab786350d5cbced44f907301e6c8b.zip gcc-8a20d031eabab786350d5cbced44f907301e6c8b.tar.gz gcc-8a20d031eabab786350d5cbced44f907301e6c8b.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/class.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_final.C | 14 |
3 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d05719b..b88976b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com> + + 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 <nathan@acm.org> * cp-tree.h (IDENTIFIER_LAMBDA_P): New. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index a2585a6..d6ac6ce 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 b3875ad..20e5d62 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<int>), "Ff<int> is final" ); static_assert( __is_final (Ff<A>), "Ff<A> is final" ); static_assert( __is_final (Ff<Af>), "Ff<Af> is final" ); +// PR 85254 + +template <class T> struct final_trait_wrap{ typedef T type; }; + +template <class T> struct my_is_final +{ + static const bool value = __is_final(typename final_trait_wrap<T>::type); +}; + +struct final1 final {}; +template <typename T> struct final2 final {}; + +static_assert( my_is_final<final1>::value, "final1 is final" ); +static_assert( my_is_final<final2<int>>::value, "final2<int> is final" ); |