https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69098
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- This fixes it: diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ef79b59..264c8aa 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13735,7 +13735,19 @@ tsubst_qualified_id (tree qualified_id, tree args, } if (is_template) - expr = lookup_template_function (expr, template_args); + { + if (variable_template_p (expr)) + { + expr = lookup_template_variable (expr, template_args); + if (!any_dependent_template_arguments_p (template_args)) + { + expr = finish_template_variable (expr, complain); + mark_used (expr); + } + } + else + expr = lookup_template_function (expr, template_args); + } if (expr == error_mark_node && complain & tf_error) qualified_name_lookup_error (scope, TREE_OPERAND (qualified_id, 1),