-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][bytecode] Fix modify_global diagnostics in C++11 #108358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We shouldn't emit this until C++14.
@llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) ChangesWe shouldn't emit this until C++14. Full diff: https://github.com/llvm/llvm-project/pull/108358.diff 2 Files Affected:
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}}
+}
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/139/builds/3638 Here is the relevant piece of the build log for the reference
|
We shouldn't emit this until C++14.