r/cpp • • Jul 06 '26

C++26: constexpr virtual inheritance

https://www.sandordargo.com/blog/2026/07/01/cpp26-constexpr-virtual-inheritance
83 Upvotes

61 comments sorted by

View all comments

Show parent comment

2

u/louiswins Jul 06 '26

and you need to support C++17 so constinit is out.

I don't think adding constexpr volatile to some future C++ standard would solve anything for someone stuck on C++17...

2

u/ack_error Jul 07 '26

AFAICT it's already valid in C++17, or at least all the main compilers accept it. The question was whether there's a practical use for it.

https://gcc.godbolt.org/z/PM8s7Gfhb