https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93870
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Completely untested: --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7082,7 +7082,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) create a TARGET_EXPR, but in a template we can't use AGGR_INIT_EXPR, and the TARGET_EXPR would lead to a bogus error. */ - || (val_dep_p && MAYBE_CLASS_TYPE_P (type)))) + || val_dep_p)) { expr = build1 (IMPLICIT_CONV_EXPR, type, expr); IMPLICIT_CONV_EXPR_NONTYPE_ARG (expr) = true;