From 4c8d7a2230f59f877369095b1b699f42820fffdf Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Sat, 18 Feb 2023 20:46:05 +0700 Subject: [PATCH 1/2] virtual functions can be constexpr --- docs/cpp/constexpr-cpp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cpp/constexpr-cpp.md b/docs/cpp/constexpr-cpp.md index 4620d2775fa..5c49bf360f6 100644 --- a/docs/cpp/constexpr-cpp.md +++ b/docs/cpp/constexpr-cpp.md @@ -61,7 +61,7 @@ The following rules apply to constexpr functions: - A **`constexpr`** function can be recursive. -- It can't be [virtual](../cpp/virtual-cpp.md). A constructor can't be defined as **`constexpr`** when the enclosing class has any virtual base classes. +- Before C++20 it couldn't be [virtual](../cpp/virtual-cpp.md). A constructor couldn't be defined as **`constexpr`** when the enclosing class had any virtual base classes. Visual C++ supports **`constexpr`** virtual functions since Visual Studio 2019 16.10. - The body can be defined as `= default` or `= delete`. From 32214557be489e8aef10294dcccfb40e565aa358 Mon Sep 17 00:00:00 2001 From: Colin Robertson <3836425+corob-msft@users.noreply.github.com> Date: Tue, 21 Feb 2023 13:06:02 -0800 Subject: [PATCH 2/2] Use boilerplate form for VS version, /std flag Some passive constructions can't be avoided. --- docs/cpp/constexpr-cpp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cpp/constexpr-cpp.md b/docs/cpp/constexpr-cpp.md index 5c49bf360f6..0096561562a 100644 --- a/docs/cpp/constexpr-cpp.md +++ b/docs/cpp/constexpr-cpp.md @@ -61,7 +61,7 @@ The following rules apply to constexpr functions: - A **`constexpr`** function can be recursive. -- Before C++20 it couldn't be [virtual](../cpp/virtual-cpp.md). A constructor couldn't be defined as **`constexpr`** when the enclosing class had any virtual base classes. Visual C++ supports **`constexpr`** virtual functions since Visual Studio 2019 16.10. +- Before C++20, a **`constexpr`** function can't be [virtual](../cpp/virtual-cpp.md), and a constructor can't be defined as **`constexpr`** when the enclosing class has any virtual base classes. In C++20 and later, a **`constexpr`** function can be virtual. Visual Studio 2019 version 16.10 and later versions support **`constexpr`** virtual functions when you specify the [`/std:c++20`](../build/reference/std-specify-language-standard-version.md) or later compiler option. - The body can be defined as `= default` or `= delete`.