https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113060
--- Comment #8 from Jiang An <de34 at live dot cn> --- (In reply to Giuseppe D'Angelo from comment #7) > Hi, > > > Note that this example adds a mediate function template > > (test_array_element_initializable) to "reduce" the non-constexpr-ness of > > std::declval. > > That's very clever, thank you! > > Is it _supposed_ to work, though? I had imagined (possibly erroneusly) that > once one places the call to `test_array_element_initializable` using > `declval` as an argument, it would disqualify the whole thing from being > usable in constant expressions. > > (It would help to have another compiler that implements P2280, so to do more > tests...) I think it's supposed to work. Enclosing std::declval calls don't matter because only the constantness in the trailing return type would affect overload resolution. Ah, we don't even need to call the function template or function pointers - it's sufficient to only detect the well-formedness of the function type. The simplest "fix" I found is changing `void_t<decltype(_Arr<_Ti>{{std::declval<_Tp>()}})>` to `void_t<auto (_Tp&& __t) -> decltype(_Arr<_Ti>{{std::forward<_Tp>(__t)}})>` , which seemingly works (https://godbolt.org/z/8M85zre5P).