From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4DC99383B436; Tue, 20 Apr 2021 17:44:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DC99383B436 From: "vittorio.romeo at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100157] New: Support `__type_pack_element` like Clang Date: Tue, 20 Apr 2021 17:44:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vittorio.romeo at outlook dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 17:44:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100157 Bug ID: 100157 Summary: Support `__type_pack_element` like Clang Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vittorio.romeo at outlook dot com Target Milestone: --- Clang provides a `__type_pack_element` builtin which allows efficient index= ing of parameter packs in variadic templates, and it seems that GCC has no equivalent. This forces users interested in minimizing compilation times to resort to arcane implemenations such as these ones: https://github.com/kvasir-io/mpl/blob/development/src/kvasir/mpl/sequence/l= ookup.hpp A builtin like `__type_pack_element` would not only allow user code to comp= ile faster, but also anything inside libstdc++ that needs to index a type list (e.g. `std::tuple_element_t`) would benefit from it. This is the Clang test driver, to show an usage example: https://github.com/llvm-mirror/clang/blob/master/test/SemaCXX/type_pack_ele= ment.cpp This is the Clang pull request: https://reviews.llvm.org/D15421=