[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #15 from Jonathan Wakely --- (In reply to Martin Liška from comment #12) > Started to ICE with -std=c++17 since r6-3372-g378b307d0d7e789c. That's the commit that added C++17 fold expressions, but the ICE doesn't depend on fold expressions. Comment 13 doesn't use them.
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 Jonathan Wakely changed: What|Removed |Added Resolution|--- |DUPLICATE Status|NEW |RESOLVED --- Comment #14 from Jonathan Wakely --- dup *** This bug has been marked as a duplicate of bug 82099 ***
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #13 from Jonathan Wakely --- I think it's just a dup of PR 82099. Reduced further to only use C++14 template struct hash { int operator()(T) const noexcept { return 0; } }; template int hash_combine(T v) noexcept(noexcept(hash()(v))) { return 0; } template auto apply(F& f, T t) { return f(t); } auto x = apply(hash_combine, 0);
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #12 from Martin Liška --- Started to ICE with -std=c++17 since r6-3372-g378b307d0d7e789c. Before that it was rejected: pr97773-2.C:30:40: error: expected primary-expression before ‘...’ token ((hash>()(v)), ...))) ^ pr97773-2.C:30:40: error: expected ‘)’ before ‘...’ token pr97773-2.C:78:1: error: expected ‘)’ at end of input } ^ pr97773-2.C:78:1: error: expected ‘)’ at end of input pr97773-2.C:78:1: error: expected initializer at end of input posix.c (backtrace_open): Cast second argument of open() to int. 2015-09-17 Ian Lance Taylor * posix.c (backtrace_open): Cast second argument of open() to int. From-SVN: r227881
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 Jonathan Wakely changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=82099 --- Comment #11 from Jonathan Wakely --- ICE happens at the same place as for PR 82099
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #10 from Jonathan Wakely --- Reduced: using size_t = decltype(sizeof(0)); template struct remove_reference { using type = T; }; template struct remove_reference { using type = T; }; template struct remove_reference { using type = T; }; template using remove_reference_t = typename remove_reference::type; struct seconds { long count() const; }; template struct hash { }; template <> struct hash { auto operator()(seconds const cp) const noexcept { return (size_t)cp.count(); } }; template size_t hash_combine(T&& ...v) noexcept(noexcept( ((hash>()(v)), ...))) { auto seed{672807365}; ( ( seed ^= hash>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2) ), ... ); return seed; } template struct tuple_node { T t; }; template struct tuple : tuple_node... { }; template auto apply(F& f, tuple t) { f(static_cast&>(t).t...); } template struct hash> { auto operator()(tuple& t) const { return apply(hash_combine, t); } }; int main() { using T = tuple; hash h; T t; h(t); }
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #9 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #7) > N.B. your program has undefined behaviour. Specializing std::hash for > standard library types is forbidden. GCC shouldn't crash though. Oh, you didn't! I misread it, sorry.
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #7 from Jonathan Wakely --- N.B. your program has undefined behaviour. Specializing std::hash for standard library types is forbidden. GCC shouldn't crash though.
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #8 from Jonathan Wakely --- (In reply to Janez Zemva from comment #6) > try -std=c++20 ? Which is why the instructions at https://gcc.gnu.org/bugs clearly say you need to provide the options used.
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #6 from Janez Zemva --- try -std=c++20 ?
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 Martin Liška changed: What|Removed |Added CC||marxin at gcc dot gnu.org --- Comment #5 from Martin Liška --- I have reduced (but invalid test-case) that ICEs: $ cat r.C template void apply(_Fn, _Tuple); template void hash_combine() noexcept(noexcept((T(), ...))); int operator0_t { apply(hash_combine<>, operator0_t); } I guess we can fix it in order to make clang++ accept it: $ clang++ r.C r.C:2:70: warning: pack fold expression is a C++17 extension [-Wc++17-extensions] template void hash_combine() noexcept(noexcept((T(), ...))); ^ r.C:4:37: error: unexpected ';' before '}' apply(hash_combine<>, operator0_t); ^ r.C:4:3: error: cannot initialize a variable of type 'int' with an rvalue of type 'void' apply(hash_combine<>, operator0_t); ^~ r.C:5:2: error: expected ';' after top level declarator } ^ ; 1 warning and 3 errors generated. ?
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 Jonathan Wakely changed: What|Removed |Added Keywords||ice-on-valid-code Status|WAITING |NEW --- Comment #4 from Jonathan Wakely --- Thanks. Confirmed.
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #3 from Janez Zemva --- Created attachment 49535 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49535=edit bug
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 --- Comment #2 from Janez Zemva --- #include #include #include #include #include #include template struct hash : std::hash { }; template <> struct hash { auto operator()(std::chrono::seconds const cp) const noexcept { return std::hash()(cp.count()); } }; template <> struct hash> { auto operator()(std::chrono::time_point const tp) const noexcept { return std::hash::rep>()(tp.time_since_epoch().count()); } }; template std::size_t hash_combine(T&& ...v) noexcept(noexcept( ((hash>()(std::declval())), ...))) { auto seed{672807365}; ( ( seed ^= hash>()(std::forward(v)) + 0x9e3779b9 + (seed << 6) + (seed >> 2) ), ... ); return seed; } template struct hash> { auto operator()(std::tuple const& t) const { return std::apply(hash_combine, t); } }; int main() { std::unordered_map< std::tuple, std::string_view>, int, hash, std::string_view>> > lol; return lol.size(); }
[Bug c++/97773] gcc crash after some noexcept magic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97773 Jonathan Wakely changed: What|Removed |Added Last reconfirmed||2020-11-10 Ever confirmed|0 |1 Status|UNCONFIRMED |WAITING --- Comment #1 from Jonathan Wakely --- Please provide a complete testcase, not just a snippet that doesn't compile. See https://gcc.gnu.org/bugs/ And please report the second bug separately.