Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-04-18 Thread Patrick Palka via Gcc-patches
t; > > > > semi-consistency > > > > > > > > > with Clang seems like a reasonable argument in favour of > > > > > > > > > keeping > > > > > > > > > the > > > > > > > > > name. I'd be open to alternativ

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-04-18 Thread Jason Merrill via Gcc-patches
ted on x86_64-pc-linux-gnu, also tested against libc++'s tuple/variant impl for good measure (which uses __type_pack_element when available). -- >8 -- Subject: [PATCH] c++: Define built-in for std::tuple_element [PR100157] This adds a new built-in to replace the recursive class template insta

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-04-11 Thread Patrick Palka via Gcc-patches
; > > name. I'd be open to alternative names though, e.g. > > > > > > > __builtin_nth_type > > > > > > > or __builtin_type_at_index. > > > > > > > > > > > > Rather than giving the trait a different name from > > > > &g

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-01-26 Thread Jason Merrill via Gcc-patches
lements the built-in in terms of TRAIT_TYPE, names it __type_pack_element instead of __builtin_type_pack_element, and treats invocations of it like a template-id instead of a call (to match Clang). -- >8 -- Subject: [PATCH] c++: Define built-in for std::tuple_element [PR100157] This adds a

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-01-25 Thread Patrick Palka via Gcc-patches
t; Rather than giving the trait a different name from __type_pack_element, > > > > I wonder if we could just special case cp_parser_trait to expect <> > > > > instead of parens for this trait? > > > > > > > > Btw the frontend recently got a ge

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-01-17 Thread Jason Merrill via Gcc-patches
instead of __builtin_type_pack_element, and treats invocations of it like a template-id instead of a call (to match Clang). -- >8 -- Subject: [PATCH] c++: Define built-in for std::tuple_element [PR100157] This adds a new built-in to replace the recursive class template instantiations done by traits su

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-01-10 Thread Jonathan Wakely via Gcc-patches
much of the boilerplate of adding a new type-yielding built-in > > > trait, see e.g. cp-trait.def. > > > > Here's a tested patch based on Jonathan's original patch that implements > > the built-in in terms of TRAIT_TYPE, names it __type_pack_element > > instead of __

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-01-09 Thread Patrick Palka via Gcc-patches
frontend recently got a generic TRAIT_TYPE tree code, which gets > > rid of much of the boilerplate of adding a new type-yielding built-in > > trait, see e.g. cp-trait.def. > > Here's a tested patch based on Jonathan's original patch that implements > the built-in in

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2023-01-09 Thread Patrick Palka via Gcc-patches
a tested patch based on Jonathan's original patch that implements the built-in in terms of TRAIT_TYPE, names it __type_pack_element instead of __builtin_type_pack_element, and treats invocations of it like a template-id instead of a call (to match Clang). -- >8 -- Subject: [PATCH] c++: Defi

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-10-05 Thread Patrick Palka via Gcc-patches
On Thu, 7 Jul 2022, Jonathan Wakely via Gcc-patches wrote: > This adds a new built-in to replace the recursive class template > instantiations done by traits such as std::tuple_element and > std::variant_alternative. The purpose is to select the Nth type from a > list of types, e.g.

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Jonathan Wakely via Gcc-patches
On Thu, 7 Jul 2022 at 20:29, Jason Merrill wrote: > > On 7/7/22 13:14, Jonathan Wakely wrote: > > This adds a new built-in to replace the recursive class template > > instantiations done by traits such as std::tuple_element and > > std::variant_alternative. The purpose is to select the Nth type

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Jason Merrill via Gcc-patches
On 7/7/22 13:14, Jonathan Wakely wrote: This adds a new built-in to replace the recursive class template instantiations done by traits such as std::tuple_element and std::variant_alternative. The purpose is to select the Nth type from a list of types, e.g. __builtin_type_pack_element(1, char,

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Marek Polacek via Gcc-patches
On Thu, Jul 07, 2022 at 06:14:36PM +0100, Jonathan Wakely wrote: > This adds a new built-in to replace the recursive class template > instantiations done by traits such as std::tuple_element and > std::variant_alternative. The purpose is to select the Nth type from a > list of types, e.g.

[PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Jonathan Wakely via Gcc-patches
This adds a new built-in to replace the recursive class template instantiations done by traits such as std::tuple_element and std::variant_alternative. The purpose is to select the Nth type from a list of types, e.g. __builtin_type_pack_element(1, char, int, float) is int. For a pathological