On Tue, 2 Jun 2026 at 18:04, Yuao Ma <[email protected]> wrote: > > On Tue, Jun 2, 2026 at 11:01 PM Jonathan Wakely <[email protected]> wrote: > > > > On Tue, 2 Jun 2026 at 15:59, Yuao Ma <[email protected]> wrote: > > > > > > Hi! > > > > > > This patch makes std::priority_queue constexpr as part of P3372R3. I > > > am unsure whether I should add the FTM here; since the constexpr > > > support for std::queue isn't complete yet, I have omitted the FTM from > > > this patch. > > > > Yes, that's the correct choice, thanks. > > > > > Tested on x86_64-linux. OK for trunk? > > > > > > Additionally, regarding the implementation strategy for other standard > > > containers like std::list, it seems inevitable that we will need to > > > move some function implementations (like _List_node_base) from the .cc > > > files to the headers. This looks like an ABI break. Is this > > > acceptable? > > > > No. It needs to be done without ABI breaks (which is possible, but > > awkward and complex). > > > > BTW, could you elaborate more on how to achieve this in general? The > only approach I can think of is using attributes like noinline and > default visibility.
Neither of those. There are several ways. They only need to be constexpr (and therefore inline) for C++26, so the definitions can be copied into the headers like so: #if __cplusplus >= 202603L // inline definitions #endif and keep them in src/c++98/list.cc as well, where they are compiled with -std=gnu++98. (The code duplication can be solved easily enough by putting them in a dedicated header and appropriate use of macros.) Programs which expect to find the definitions in the library will still find them in the library, programs compiled with -std=gnu++26 will get the definitions in the header. We already do similar things for std::string and everything in <stdexcept>.
