https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101460
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-07-15 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- I suppose the problem here is that the failed constant evaluation of frob<-1>() only happens as a result of trying to use it as a template argument (where a constant expression is required) which doesn't happen until overload resolution is performed. So we have to at least being doing OR before we get a problem. But maybe we can remember that it failed once, and so stop trying. If it's not a valid constant expression, *that* is the error, not the fact that none of the get<N> overloads can be called with an invalid constant expression. Even if I change the code to do this it keeps trying overload resolution for get<n>: template<int N> void get_n(tuple& t) { constexpr unsigned n = frob<N>(); get<n>(t); } The constexpr initialization of 'n' failed with a static_assert *and* a non-constant narrowing conversion, so why do we continue and even attempt overload resolution for 'get'?