Re: Spaceship-operator: why the data-members must be public / triggers ICE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 Dec 2019, 08:39 Klaus Doldinger, <klaus.doldinger64@xxxxxxxxx> wrote:
>
>
> Am 13.11.19 um 13:47 schrieb Jonathan Wakely:
> > On Wed, 13 Nov 2019 at 11:43, Klaus Doldinger
> > <klaus.doldinger64@xxxxxxxxx> wrote:
> >>
> >>
> >>
> >> Am 13.11.19 um 11:35 schrieb Jonathan Wakely:
> >>> On Wed, 13 Nov 2019 at 09:24, Klaus Doldinger
> >>> <klaus.doldinger64@xxxxxxxxx> wrote:
> >>>>
> >>>> Hi all,
> >>>>
> >>>> in the follwing example
> >>>>
> >>>> #include <compare> // omitting trigger ICE
> >>>>
> >>>> template<auto V>
> >>>> struct A {};
> >>>>
> >>>> struct B {
> >>>>     inline constexpr auto operator<=>(const B& rhs) const = default;
> >>>> private:
> >>>>     int value; // why must this member be public?
> >>>> };
> >>>>
> >>>> int main() {
> >>>>     A<B{}> t;
> >>>> }
> >>>>
> >>>> why must the member value be public?
> >>>
> >>> Looks like a bug, please report it to bugzilla.
> >>
>
> Ok, we found this not to be a bug.
>
> But, how do I write a class to use as NTTP with private members?


You don't.

>
> I'm a bit confused about:
>
> https://en.cppreference.com/w/cpp/language/template_parameters
>
> Here string structural equality does not require all public members.
> It must be literal and the members must be structural revursively.


That page hasn't been edited in more than six months, it doesn't
describe the current status of the C++20 draft.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux