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

--- Comment #7 from Diego Franco <di...@franco-technologies.com> ---
This works:

#include <vector>
#include <cassert>

struct A
{
  operator const int&() const
  {
    return a_;
  }

  int a_;
};

int main()
{
  A a {};

  const auto& b1 {static_cast<const int&>(a)};
  const int& b2 {a};

  assert(&a.a_ == &b1);
  assert(&b1 == &b2);  // works

Reply via email to