https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67762
--- Comment #8 from Curdeius Curdeius <curdeius at gmail dot com> --- A different (rather small) reproduce. https://godbolt.org/z/bz9sTd34o It fails with all the versions of gcc from at least 7 (the above code needs `auto` in template non-type parameter) to trunk from 2021-11-10. Hope it helps! ``` #include <date/date.h> #include <chrono> #include <functional> namespace detail { static inline void validate(date::weekday v) noexcept { (void)v; assert(v.ok()); } template <typename Duration, auto InitValue, auto GetValue = nullptr> struct date_interval { using duration_type = Duration; duration_type begin{InitValue}; [[nodiscard]] constexpr auto begin_value() const noexcept { if constexpr (GetValue != nullptr) { return std::invoke(GetValue, begin); } else { return begin; } } }; } // namespace detail using days_interval = detail::date_interval<date::weekday, /*date::Sunday*/ 7, &date::weekday::c_encoding>; int main() { days_interval days; return (int)days.begin_value(); } ```