C++ Logo

sg7

Advanced search

Re: [SG7] status of reflection

From: Matus Chochlik <chochlik_at_[hidden]>
Date: Mon, 30 Aug 2021 21:12:14 +0200
Hi SG7,

I've been playing with some of my use cases recently and today I managed to
break the compiler implementing P2320 when messing with pointers to class
data members.
This is a minimal example:
`
#include <experimental/compiler>
#include <experimental/compiler>

struct S {
    int i{0};
}

consteval auto reflect_S_i() {
    using namespace std::experimental::meta;
    return *members_of(^S, is_data_member).begin();
};

auto main() -> int {
    S s{};
    const auto mp = &([: reflect_S_i() :]);
   (s.*mp) = 1;
    return 0;
}
`
Compiling the above results in a compiler crash.
Is `&([: reflect_S_i() :])` the correct syntax to unreflect the data member
and get the pointer to it, or am I doing something wrong?

BR
--Matus

On Fri, Aug 27, 2021 at 12:28 PM Jagrut Dave via SG7 <sg7_at_[hidden]>
wrote:

> Agreed, will discuss early feedback here itself. Thanks.
>
> On Aug 27, 2021 2:36 AM, Hana Dusíková <hanicka_at_[hidden]> wrote:
>
> If you want an early feedback, you can discuss it here on the mailing
> list. I would prefer that, it gives option for everyone to join.
>
> Hana
>
> On 27. 8. 2021, at 3:10, Jagrut Dave via SG7 <sg7_at_[hidden]> wrote:
>
> Ok sure I will reach out to you separately once I start work. Thanks.
>
> On Aug 26, 2021 1:00 AM, Roland Bock via SG7 <sg7_at_[hidden]> wrote:
>
> Feel free to ping me if you want some early feedback.
>
> On 25.08.21 21:02, Jagrut Dave via SG7 wrote:
> > Hi Hana,
> > I'm collecting use-cases for Reflection in my company (Bloomberg),
> > working with David Sankel. The idea is to analyze how they would work
> > with the APIs and syntax that has been proposed thus far. It will
> > probably take a few months to come up with a proper list, and analyze
> > the gaps. Just wanted to let you know about this effort.
> >
> > Thanks,
> > Jagrut
> >
> > ------------------------------------------------------------------------
> > *From:* SG7 <sg7-bounces_at_[hidden]> on behalf of Hana Dusíková
> > via SG7 <sg7_at_[hidden]>
> > *Sent:* Tuesday, August 24, 2021 12:05 PM
> > *To:* SG7 <sg7_at_[hidden]>
> > *Cc:* Hana Dusíková <hanicka_at_[hidden]>
> > *Subject:* [SG7] status of reflection
> > Hello my lovely group!
> >
> > I noticed there is almost no traffic recently. So if you have any
> > reflection-related idea, please bring it on in form of paper, or just a
> > notion here on mailing list. I heard Daveed is working on some paper. So
> > this is more nudge than nudge than a status.
> >
> > Hana
> > --
> > SG7 mailing list
> > SG7_at_[hidden]
> > https://lists.isocpp.org/mailman/listinfo.cgi/sg7
> > <https://lists.isocpp.org/mailman/listinfo.cgi/sg7>
> >
> --
> SG7 mailing list
> SG7_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg7
>
>
> --
> SG7 mailing list
> SG7_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg7
>
>
>
> --
> SG7 mailing list
> SG7_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg7
>

Received on 2021-08-30 14:12:27