C++ Logo


Advanced search

Re: [SG7] SG7 Digest, Vol 11, Issue 2

From: Andrew Sutton <asutton.list_at_[hidden]>
Date: Wed, 4 Nov 2020 13:02:06 -0500
> 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).

Received on 2020-11-04 12:02:20