https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109876
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> --- > Instead, we should probably treat num as value-dependent even though it > actually isn't. An attempt to implement that: --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -27969,6 +27969,12 @@ value_dependent_expression_p (tree expression) else if (TYPE_REF_P (TREE_TYPE (expression))) /* FIXME cp_finish_decl doesn't fold reference initializers. */ return true; + else if (DECL_DECLARED_CONSTEXPR_P (expression) + && TREE_STATIC (expression) + && !DECL_NAMESPACE_SCOPE_P (expression) + && DECL_INITIAL (expression) + && TREE_CODE (DECL_INITIAL (expression)) == IMPLICIT_CONV_EXPR) + return true; return false; case DYNAMIC_CAST_EXPR: