https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109876
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Marek Polacek from comment #8) > > 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) I'd expect we could get a similar issue with non-static constexprs. > + && !DECL_NAMESPACE_SCOPE_P (expression) This seems an unnecessary optimization? > + && DECL_INITIAL (expression) Perhaps we also want to return true if DECL_INITIAL is null? > + && TREE_CODE (DECL_INITIAL (expression)) == IMPLICIT_CONV_EXPR) Maybe !TREE_CONSTANT?