C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: What's going on with non-transient constexpr allocations?
From: Tam S. B. (cpplearner_at_[hidden])
Date: 2019-06-13 20:52:40


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.


STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups