llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.52k stars 11.79k forks source link

constexpr not allowed on member function of type with a virtual base. #112016

Open i-photon opened 5 days ago

i-photon commented 5 days ago

Virtual constexpr has been allowed since C++20. What happened?

Here's my sentiment: https://godbolt.org/z/f8hYGYMab

This is causing a needless headache trying to re-use interfaces in constexpr.

llvmbot commented 5 days ago

@llvm/issue-subscribers-clang-frontend

Author: None (i-photon)

Virtual constexpr has been allowed since C++20. What happened? Here's my sentiment: https://godbolt.org/z/f8hYGYMab This is causing a needless headache trying to re-use interfaces in constexpr.
llvmbot commented 5 days ago

@llvm/issue-subscribers-c-20

Author: None (i-photon)

Virtual constexpr has been allowed since C++20. What happened? Here's my sentiment: https://godbolt.org/z/f8hYGYMab This is causing a needless headache trying to re-use interfaces in constexpr.
cor3ntin commented 5 days ago

The restriction only applies to structors https://eel.is/c++draft/dcl.dcl#dcl.constexpr-3

frederick-vs-ja commented 5 days ago

Looks like a duplicate of #97266.

Virtual constexpr has been allowed since C++20.

This is unrelated to virtual base classes.