C++ Logo

SG7

Advanced search

Subject: Re: SG7 Digest, Vol 11, Issue 2
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2020-11-04 12:02:06


>
> The way our implementation works is that we do analysis of default inits,
> function bodies on the closing brace of the fragment. We don't consider the
> context to be the outermost class because it's a separate class (until it
> gets injected).
>
>
> Right, I suspected so much. But it feels like quite the gotcha. OTOH, if
> we want to parse all fragment contents up front, I don't know how to avoid
> it.
>

I don't think it's *that* bad. But I'm not what I want the design to be.

Here's another way to look at it.

struct A2 {
  struct B {};
  struct D;
  consteval { -> gen<reflexpr(D)>(); }
  struct D : B {};
};

template<info X>
consteval info gen(info t) {
  return <struct { auto x = |X|(); }>; // OK?
}

I think that's going to be an error, and I suspect it should be. Otherwise,
we would always defer the parsing of default member initializers and
friends until injection time. That would also make it possible to write
code that's never actually parsed (e.g., an inline member function of a
fragment that isn't injected).



SG7 list run by sg7-owner@lists.isocpp.org

Older Archives on Google Groups