From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6275C3858D32; Fri, 11 Aug 2023 00:19:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6275C3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691713173; bh=BgZXwHi05tfDT9sx+NwAZuaJwjAsO98/VQfn6odOgLY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SNFh2wzKeIL7oB5GOdgBGEUF+liGm4SVCOGnUtlXHTQaNJuGdFnj7fqqpx71Dhwqd hq3mQYPfkD9piJwN6fd7tSI/H3ji5TprqCJMkCAZWtezDOjEu6fOyQIq3dslC/ak2i UpRxLM2YAQZgHM2ozx14uutLN5eaTz5FdENWq5yA= From: "namniav at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105644] ICE in a fold expression with a requires expression: in iterative_hash_template_arg, at cp/pt.cc:1805 Date: Fri, 11 Aug 2023 00:19:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.1.1 X-Bugzilla-Keywords: ice-on-valid-code, needs-reduction X-Bugzilla-Severity: normal X-Bugzilla-Who: namniav at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105644 --- Comment #2 from Namniav --- Now Clang also crashes on the original example(https://github.com/llvm/llvm-project/issues/64607), although its ca= use may be different to GCC's. I can't remember why I used `get` instead of `std::get` in original code because I didn't really know how ADL finds function templates. The issue st= ill exists with `std::get`. Here is a modified and GCC-only reduced version: https://godbolt.org/z/MMYMrGE3z ```c++ template concept C =3D (sizeof(I) + sizeof(T) > 0); template constexpr bool check() { return ((requires(T t) { { (I, t) } -> C; }) && ...); } template concept tuple_like =3D check(); static_assert(tuple_like); ``` Noted that GCC doesn't consider using `I` in `-> C` as using a parameter pack, I have to use it in comma expression `(I, t)` to get a fold expressio= n, otherwise GCC complains "operand of fold expression has no unexpanded param= eter packs". I suspect that GCC has problem with such case. It some how explains, for GCC only, why replacing `std::tuple_element_t&` with `int&` "fixe= s" the issue.=