[clang] [clang-cl] Add support for [[msvc::constexpr]] C++11 attribute (PR #71300)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 06:21:04 PST 2023


================
@@ -3657,6 +3657,21 @@ an error:
 }];
 }
 
+def MSConstexprDocs : Documentation {
+  let Category = DocCatStmt;
+  let Content = [{
+The ``[[msvc::constexpr]]`` attribute can be applied only to a function
+definition or a ``return`` statement. It does not impact function declarations.
+A ``[[msvc::constexpr]]`` function cannot be ``constexpr`` or ``consteval``.
+A ``[[msvc::constexpr]]`` function is treated as if it were a ``constexpr`` function
+if it is evaluated in a constant context of ``[[msvc::constexpr]] return`` statement.
----------------
erichkeane wrote:

```suggestion
when it is evaluated in a constant context of ``[[msvc::constexpr]] return`` statement.
```

https://github.com/llvm/llvm-project/pull/71300


More information about the cfe-commits mailing list