[lld] [mlir] [llvm] [openmp] [libcxxabi] [libunwind] [lldb] [libcxx] [clang] [compiler-rt] [flang] [libc] [clang-tools-extra] [C23] Implement N3018: The constexpr specifier for object definitions (PR #73099)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 07:38:37 PST 2023


================
@@ -13816,7 +13862,9 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
       VDecl->setStorageClass(SC_Extern);
 
     // C99 6.7.8p4. All file scoped initializers need to be constant.
-    if (!getLangOpts().CPlusPlus && !VDecl->isInvalidDecl())
+    // Avoid double diagnosing for constexpr variables.
----------------
cor3ntin wrote:

```suggestion
    // Avoid double diagnoses for constexpr variables.
```

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


More information about the llvm-commits mailing list