]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/85254 (boost::is_final does not work for template types)
authorVille Voutilainen <ville.voutilainen@gmail.com>
Sat, 26 Oct 2019 17:32:24 +0000 (20:32 +0300)
committerVille Voutilainen <ville@gcc.gnu.org>
Sat, 26 Oct 2019 17:32:24 +0000 (20:32 +0300)
PR c++/85254

Backport from mainline
2019-06-01  Ville Voutilainen  <ville.voutilainen@gmail.com>

PR c++/85254
* class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.

From-SVN: r277474

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

index 8f801de7560c2bed46146078c529d8e309d83ffb..e0224a0c421f4a8085cc762a35f0557dc5fe0398 100644 (file)
@@ -1,3 +1,12 @@
+2018-10-26  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       Backport from mainline
+
+       2019-06-01  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/85254
+       * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
+
 2019-10-24  Marek Polacek  <polacek@redhat.com>
 
        * decl.c (reshape_init_r): Add missing space.
index b3b06eca3747891613967dabcd535000c6b82fb5..f7059fb7341b2289c608b2d22ce89ee3e4fb6141 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 b3875ad04aec7d87b94cf779925caec76b6152c0..20e5d629ff5c3d21552b7b54bf1306efb62cbee6 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" );