https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103478
Bug ID: 103478 Summary: Possible regression in constexpr processing Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fchelnokov at gmail dot com Target Milestone: --- The following code is accepted by GCC 9.4 and rejected by GCC 10.1: ``` #include <array> using namespace std; template<size_t N> using string_literal_t = char[N]; template<class T> struct StrSize; ///< metafunction to get the size of string literal alikes /// specialize StrSize for string literals template<size_t N> struct StrSize <string_literal_t<N>>{ static constexpr size_t value = N-1; }; /// template variable, just for convenience template <class T> constexpr size_t str_size = StrSize<T>::value; /// now do the same but with constexpr function template<class T> constexpr auto strsize(const T&) noexcept-> decltype(str_size<T>) { return str_size<T>; } template<class S, size_t... Is> constexpr auto test_helper(const S& s, index_sequence<Is...>) noexcept-> array<char, str_size<S>> { return {s[Is]...}; } template<class S> constexpr auto test(const S& s) noexcept-> decltype(auto) { return test_helper(s, make_index_sequence<strsize(s)>{}); } auto main()-> int { static_assert(strsize("qwe") == 3, ""); static_assert(noexcept(test("qwe")) == true, ""); return 0; } ``` Demo: https://gcc.godbolt.org/z/43TcY485x Could you please check whether it is a regression? Related discussion: https://stackoverflow.com/q/43072361/7325599