Skip to content

Commit f22a8d1

Browse files
authored
[clang][bytecode] Fix modify_global diagnostics in C++11 (#108358)
We shouldn't emit this until C++14.
1 parent 849d1b8 commit f22a8d1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
883883
return diagnoseUnknownDecl(S, OpPC, D);
884884

885885
assert(AK == AK_Assign);
886-
if (S.getLangOpts().CPlusPlus11) {
886+
if (S.getLangOpts().CPlusPlus14) {
887887
const SourceInfo &E = S.Current->getSource(OpPC);
888888
S.FFDiag(E, diag::note_constexpr_modify_global);
889889
}

clang/test/AST/ByteCode/cxx11.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,8 @@ namespace FinalLtorDiags {
169169
A<q> c; // both-error {{non-type template argument of type 'int *' is not a constant expression}} \
170170
// both-note {{read of non-constexpr variable 'q' is not allowed in a constant expression}}
171171
}
172+
173+
void lambdas() {
174+
int d;
175+
int a9[1] = {[d = 0] = 1}; // both-error {{not an integral constant expression}}
176+
}

0 commit comments

Comments
 (0)