re PR c++/85254 (boost::is_final does not work for template types)
authorVille Voutilainen <ville.voutilainen@gmail.com>
Sat, 1 Jun 2019 10:57:12 +0000 (13:57 +0300)
committerVille Voutilainen <ville@gcc.gnu.org>
Sat, 1 Jun 2019 10:57:12 +0000 (13:57 +0300)
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

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/g++.dg/ext/is_final.C

index d05719b..b88976b 100644 (file)
@@ -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.
index a2585a6..d6ac6ce 100644 (file)
@@ -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);
 
index b3875ad..20e5d62 100644 (file)
@@ -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" );