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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Klaus Doldinger
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?

Side note: if I omit #include <compare> it triggers an ICE.

Compiler: gcc-trunk
Reply | Threaded
Open this post in threaded view
|

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

Jonathan Wakely-4
On Wed, 13 Nov 2019 at 09:24, Klaus Doldinger
<[hidden email]> 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.

> Side note: if I omit #include <compare> it triggers an ICE.

And please report that to bugzilla too, as a second bug.
Reply | Threaded
Open this post in threaded view
|

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

Klaus Doldinger


Am 13.11.19 um 11:35 schrieb Jonathan Wakely:

> On Wed, 13 Nov 2019 at 09:24, Klaus Doldinger
> <[hidden email]> 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.

Done.

>
>> Side note: if I omit #include <compare> it triggers an ICE.
>
> And please report that to bugzilla too, as a second bug.
>

Done.
Reply | Threaded
Open this post in threaded view
|

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

Jonathan Wakely-4
On Wed, 13 Nov 2019 at 11:43, Klaus Doldinger
<[hidden email]> wrote:

>
>
>
> Am 13.11.19 um 11:35 schrieb Jonathan Wakely:
> > On Wed, 13 Nov 2019 at 09:24, Klaus Doldinger
> > <[hidden email]> 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.
>
> Done.
>
> >
> >> Side note: if I omit #include <compare> it triggers an ICE.
> >
> > And please report that to bugzilla too, as a second bug.
> >
>
> Done.

Thanks!