llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

We shouldn't emit this until C++14.

---
Full diff: https://github.com/llvm/llvm-project/pull/108358.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Interp.cpp (+1-1) 
- (modified) clang/test/AST/ByteCode/cxx11.cpp (+5) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index 2fa8b40f6085ad..827a177f9bf830 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -883,7 +883,7 @@ bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer 
&Ptr,
     return diagnoseUnknownDecl(S, OpPC, D);
 
   assert(AK == AK_Assign);
-  if (S.getLangOpts().CPlusPlus11) {
+  if (S.getLangOpts().CPlusPlus14) {
     const SourceInfo &E = S.Current->getSource(OpPC);
     S.FFDiag(E, diag::note_constexpr_modify_global);
   }
diff --git a/clang/test/AST/ByteCode/cxx11.cpp 
b/clang/test/AST/ByteCode/cxx11.cpp
index 481e3da9289efa..86b58283023bc8 100644
--- a/clang/test/AST/ByteCode/cxx11.cpp
+++ b/clang/test/AST/ByteCode/cxx11.cpp
@@ -169,3 +169,8 @@ namespace FinalLtorDiags {
   A<q> c; // both-error {{non-type template argument of type 'int *' is not a 
constant expression}} \
           // both-note {{read of non-constexpr variable 'q' is not allowed in 
a constant expression}}
 }
+
+void lambdas() {
+  int d;
+  int a9[1] = {[d = 0] = 1}; // both-error {{not an integral constant 
expression}}
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/108358
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to