https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120775

--- Comment #33 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to friedkeenan from comment #32)
> Not sure if this is already a known bug (I don't think it's listed here at
> least, but if I'm wrong, then I apologize), but the following code currently
> causes an ICE:
> 
> #include <meta>
> 
> template<typename T>
> void func() {
>     constexpr auto ctx = std::meta::access_context::unprivileged();
> }

Doesn't actually need anything from <meta> in that case,
struct S {
  using info = decltype (^^int);
  consteval S (info x) noexcept : a {x} { }
  consteval S (const S &) = default;
  static consteval S bar () noexcept { return S { info {} }; }
  info a;
};

template <typename T>
void foo ()
{
  constexpr auto ctx = S::bar ();
}
ICEs too.
Commenting out the defaulted copy constructor fixes this.

And, it doesn't need reflection either,
struct S {
  consteval S (int x) noexcept : a {x} { }
  consteval S (const S &) = default;
  static consteval S bar () noexcept { return S { int {} }; }
  int a;
};

template <typename T>
void
foo ()
{
  constexpr auto s = S::bar ();
}
ICEs too and doesn't need reflection branch, so let me file that separately.

Reply via email to