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

--- Comment #1 from Luke Dalessandro <ldalessandro at gmail dot com> ---
It is possible to workaround this bug by creating a symbol for the offending
allocation in the IILE. 

https://godbolt.org/z/jeoEra


```
struct vector {
    int *data;
    int n;
    constexpr vector() : data(new int[1]{}), n(1) {}
    constexpr ~vector() { delete [] data; }
};

struct Foo {
    constexpr auto foo() const {
        return vector();
    }
};

template <auto& f>
constexpr static auto bar() {
    [] { 
        auto temp = f.foo(); // <-- **** GIVE THIS A NAME
        return temp.n; 
    }();
    return true;
}

constexpr Foo foo;
constexpr auto dd = bar<foo>();
```

Reply via email to