https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85254
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- I hoped this would fix it, but it didn't: --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -9010,6 +9010,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) return type_code1 == ENUMERAL_TYPE; case CPTK_IS_FINAL: + type1 = TYPE_MAIN_VARIANT (type1); return CLASS_TYPE_P (type1) && CLASSTYPE_FINAL (type1); case CPTK_IS_LITERAL_TYPE: