Re: [PATCH] libstdc++: Allow adjacent __maybe_present_t to overlap

2024-04-02 Thread Pilar Latiesa
> > This is subjectively horrible and, more objectively, would create > > longer mangled names and additional RTTI. > Yeah, it's a neat trick but probably not appropriate to use within the > standard library. I understand. I was genuinely curious about whether this would do the trick. In fact,

Re: [PATCH] libstdc++: Allow adjacent __maybe_present_t to overlap

2024-04-02 Thread Patrick Palka
On Tue, 2 Apr 2024, Jonathan Wakely wrote: > On Tue, 2 Apr 2024 at 18:00, Pilar Latiesa wrote: > > > > Just out of curiosity: would this also work? > > > > template > > struct _Absent {}; > > > > template > > using __maybe_present_t = __conditional_t<_Present, _Tp, _Absent<_Tp, > > _Disc>>; > >

Re: [PATCH] libstdc++: Allow adjacent __maybe_present_t to overlap

2024-04-02 Thread Jonathan Wakely
On Tue, 2 Apr 2024 at 18:00, Pilar Latiesa wrote: > > Just out of curiosity: would this also work? > > template > struct _Absent {}; > > template > using __maybe_present_t = __conditional_t<_Present, _Tp, _Absent<_Tp, _Disc>>; > > That would avoid having to type 0, 1, ... manually. This is

Re: [PATCH] libstdc++: Allow adjacent __maybe_present_t to overlap

2024-04-02 Thread Pilar Latiesa
Just out of curiosity: would this also work? template struct _Absent {}; template using __maybe_present_t = __conditional_t<_Present, _Tp, _Absent<_Tp, _Disc>>; That would avoid having to type 0, 1, ... manually.

Re: [PATCH] libstdc++: Allow adjacent __maybe_present_t to overlap

2024-04-02 Thread Jonathan Wakely
On Mon, 1 Apr 2024 at 23:16, Patrick Palka wrote: > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? This is a layout change for some specializations of slide_view, but better to do that now than change it between gcc 14 and 15. OK for trunk. > > -- >8 -- > > Currently

[PATCH] libstdc++: Allow adjacent __maybe_present_t to overlap

2024-04-01 Thread Patrick Palka
Tested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Currently __maybe_present_t maps to the same empty class type independent of T. This is suboptimal because it means adjacent __maybe_present_t members with the [[no_unique_address]] attribute can't overlap even if the