Subject: Allow virtual base classes in constexpr
From: Lyberta (lyberta_at_[hidden])
Date: 2019-05-31 18:24:00
I have a serialization library that is designed very similar to standard
streams. So I have a very base class and virtually inherit input and
output streams from it. Naturally, most of the functions are virtual.
When I heard that virtual functions are allowed in constexpr in c++20, I
was excited because I thought I would be able to make most of the code
constexpr. Especially span streams that don't use any dynamic allocation.
When GCC 9 was released a month ago with support for virtual constexpr,
the first thing I tried is to aggressively add constexpr to my library.
I was immediately stopped by compiler because virtual base classes are
There is a proposal for text streams that use std::span - p0448. I think
if we allow constexpr virtual bases, we can have constexpr span streams
STD-PROPOSALS list run by herb.sutter at gmail.com
Standard Proposals Archives on Google Groups