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

--- Comment #3 from Boris Staletic <boris.staletic at protonmail dot com> ---
> if underlying_var.rvp appeared there instead.

When I try that (i.e. without structured bindings), the ICE is gone, but I do
get

foo.cpp: In function ‘auto bind_function()’:
foo.cpp:8:10: error: consteval-only expressions are only allowed in a
constant-evaluated context
    8 |     sink(attrs.rvp);
      |          ^~~~~


And if I also first copy attrs.rvp to another char (attrs is what I called the
equivalent of the underlying_var), then that compiles.

In other words, the structured bindings version ICEs, the following one errors
like the above:

auto bind_function() {
    constexpr auto attrs = extra_attributes{};
    sink(attrs.rvp);
}

And this one compiles:

auto bind_function() {
    constexpr auto attrs = extra_attributes{};
    char rvp = attrs.rvp;
    sink(rvp);
}

I'd expect all three versions to work, but if not, then at least to behave the
same.

Reply via email to