* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
@ 2020-07-13 13:24 ` wjwray at gmail dot com
2020-07-14 6:49 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: wjwray at gmail dot com @ 2020-07-13 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #1 from Will Wray <wjwray at gmail dot com> ---
Clang ticket https://bugs.llvm.org/show_bug.cgi?id=46704
MSVC ticket
https://developercommunity.visualstudio.com/idea/1111203/enhancement-please-add-a-builtin-to-count-bindings.html#
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
2020-07-13 13:24 ` [Bug c++/96185] " wjwray at gmail dot com
@ 2020-07-14 6:49 ` rguenth at gcc dot gnu.org
2020-07-14 14:56 ` wjwray at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-14 6:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |11.0
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
2020-07-13 13:24 ` [Bug c++/96185] " wjwray at gmail dot com
2020-07-14 6:49 ` rguenth at gcc dot gnu.org
@ 2020-07-14 14:56 ` wjwray at gmail dot com
2020-07-14 15:17 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: wjwray at gmail dot com @ 2020-07-14 14:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #2 from Will Wray <wjwray at gmail dot com> ---
On the Clang ticket, linked above, Richard Smith comments:
Instead of the proposed direction, I'd suggest we (and other implementers)
prioritize implementation of https://wg21.link/p1061r1
(which is on its way to standardization:
https://github.com/cplusplus/papers/issues/294).
My follow-on questions:
Would an early-delivered future feature require an opt-in switch?
Can P1061 be default enabled under earlier std flags by DR or otherwise?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
` (2 preceding siblings ...)
2020-07-14 14:56 ` wjwray at gmail dot com
@ 2020-07-14 15:17 ` redi at gcc dot gnu.org
2020-07-14 15:19 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-14 15:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Will Wray from comment #2)
> Would an early-delivered future feature require an opt-in switch?
The relevant -std switch would be the opt-in.
> Can P1061 be default enabled under earlier std flags by DR or otherwise?
Not as a DR, absolutely not. There is no defect.
It could be supported in non-strict modes as an extension, if the syntax
doesn't conflict with anything a valid program would use.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
` (3 preceding siblings ...)
2020-07-14 15:17 ` redi at gcc dot gnu.org
@ 2020-07-14 15:19 ` redi at gcc dot gnu.org
2020-07-14 15:22 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-14 15:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Will Wray from comment #0)
> (Submitting simultaneous requests for each of GCC, Clang and MSVC.
> Coordination between vendors will be beneficial for portability.)
This seems like the wrong approach. If you want something portable that works
in all implementations, propose it for the standard.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
` (4 preceding siblings ...)
2020-07-14 15:19 ` redi at gcc dot gnu.org
@ 2020-07-14 15:22 ` jakub at gcc dot gnu.org
2020-07-14 15:39 ` wjwray at gmail dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-14 15:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> Not as a DR, absolutely not. There is no defect.
>
> It could be supported in non-strict modes as an extension, if the syntax
> doesn't conflict with anything a valid program would use.
Yeah, usually it is something with pedwarn, i.e. accepted in
-std=c++2b/-std=gnu++2b mocdx, a warning in -std=gnu++20/-std=gnu++17 etc. and
an error with -std=c++20/-std=c++17.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
` (5 preceding siblings ...)
2020-07-14 15:22 ` jakub at gcc dot gnu.org
@ 2020-07-14 15:39 ` wjwray at gmail dot com
2020-07-14 15:40 ` wjwray at gmail dot com
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: wjwray at gmail dot com @ 2020-07-14 15:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #6 from Will Wray <wjwray at gmail dot com> ---
Thanks for the comment on approach Jonathan:
I'd noticed some collaboration and agreement around previous builtins
such as __builtin_bit_cast which is now available in both GCC & Clang
(though with some small inevitable divergence of behaviour).
Clearly Richard's suggestion to prioritize P1061, with such illustrious
co-authorship, is the best solution. I can offer to help on the gcc side.
This is the std way to go.
This request was borne of some frustration; I miss this facility in C++20.
By a hack, Clang happens to support SFINAE on structured binding since v5
- lack of any way to do it in GCC prompted this request.
My thinking was that a builtin can see quicker implementation and adoption
than std features. This builtin _is_ in support of a std proposal.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
` (6 preceding siblings ...)
2020-07-14 15:39 ` wjwray at gmail dot com
@ 2020-07-14 15:40 ` wjwray at gmail dot com
2020-07-14 16:08 ` redi at gcc dot gnu.org
2020-07-14 16:32 ` wjwray at gmail dot com
9 siblings, 0 replies; 11+ messages in thread
From: wjwray at gmail dot com @ 2020-07-14 15:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #7 from Will Wray <wjwray at gmail dot com> ---
Oops, __builtin_bit_cast available in MSVC and Clang (when in GCC?)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
` (7 preceding siblings ...)
2020-07-14 15:40 ` wjwray at gmail dot com
@ 2020-07-14 16:08 ` redi at gcc dot gnu.org
2020-07-14 16:32 ` wjwray at gmail dot com
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-14 16:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
But __builtin_bit_cast is the compiler magic to support std::bit_cast, it's not
just a non-standard extension. PR 93121 is a request for std::bit_cast in GCC.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96185] Enhancement: Please add a builtin to count bindings in [dcl.struct.bind]
2020-07-13 13:16 [Bug c++/96185] New: Enhancement: Please add a builtin to count bindings in [dcl.struct.bind] wjwray at gmail dot com
` (8 preceding siblings ...)
2020-07-14 16:08 ` redi at gcc dot gnu.org
@ 2020-07-14 16:32 ` wjwray at gmail dot com
9 siblings, 0 replies; 11+ messages in thread
From: wjwray at gmail dot com @ 2020-07-14 16:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96185
--- Comment #9 from Will Wray <wjwray at gmail dot com> ---
An earlier draft had __builtin_tuple_size as the magic behind the P2141
proposed std::tuple_size automagic generalization to Case 3 class types.
There was opposition to that name because it specifically doesn't apply
to tuples so I left the naming open, suggesting __builtin_binding_count
(and, so, requiring consensus on naming for portability...)
^ permalink raw reply [flat|nested] 11+ messages in thread