https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103478

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
That is:
template<class S>
constexpr auto test(const S& s) noexcept-> decltype(auto) {
   return test_helper(s, make_index_sequence<strsize(s)>{});
}

Is invalid.
Clang rejects it too but with a better diagnostic:
<source>:30:46: error: non-type template argument is not a constant expression
   return test_helper(s, make_index_sequence<strsize(s)>{});
                                             ^~~~~~~~~~
<source>:35:27: note: in instantiation of function template specialization
'test<char[4]>' requested here
   static_assert(noexcept(test("qwe")) == true, "");
                          ^
<source>:30:54: note: function parameter 's' with unknown value cannot be used
in a constant expression
   return test_helper(s, make_index_sequence<strsize(s)>{});
                                                     ^
<source>:29:30: note: declared here
constexpr auto test(const S& s) noexcept-> decltype(auto) {
                             ^


So I will leave it open for a better error message request.

Reply via email to