C++ Logo


Advanced search

Re: What's going on with non-transient constexpr allocations?

From: Tam S. B. <cpplearner_at_[hidden]>
Date: Fri, 14 Jun 2019 01:52:40 +0000
I don't know previous discussion, but I guess this is a problematic case:

    template<int> struct X;
    constexpr std::vector<std::unique_ptr<int>> V = ...;
    auto f() -> X<*V[0]>;
    *V[0] = 42;
    auto f() -> X<*V[0]>;

Here two declarations of `f()` need to have the same type, but it won't be possible if `*V[0]` doesn't have a constant value.

Received on 2019-06-13 20:54:33