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

Jiang An <de34 at live dot cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |de34 at live dot cn

--- Comment #1 from Jiang An <de34 at live dot cn> ---
Currrently, a non-empty std::vector can't be a constexpr variable, because
storage dynamically allocated in the evaluation of a constant expression must
be deallocated later in the same evaluation.

The following works (https://godbolt.org/z/aEozPcEM8):
```
#include <ranges>
#include <vector>

constexpr int one = []{
    auto v = std::views::iota(1,5) | std::ranges::to<std::vector<int>>();
    return v.front();
}();
static_assert(one == 1);
```

Reply via email to