File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2510,6 +2510,12 @@ template <class Emitter>
2510
2510
bool ByteCodeExprGen<Emitter>::visitDecl(const VarDecl *VD) {
2511
2511
assert (!VD->isInvalidDecl () && " Trying to constant evaluate an invalid decl" );
2512
2512
2513
+ // Global variable we've already seen but that's uninitialized means
2514
+ // evaluating the initializer failed. Just return failure.
2515
+ if (std::optional<unsigned > Index = P.getGlobal (VD);
2516
+ Index && !P.getPtrGlobal (*Index).isInitialized ())
2517
+ return false ;
2518
+
2513
2519
// Create and initialize the variable.
2514
2520
if (!this ->visitVarDecl (VD))
2515
2521
return false ;
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -std=c++11 -verify -emit-llvm-only %s
2
2
// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s -DCPP98
3
+ // RUN: %clang_cc1 -std=c++11 -verify -emit-llvm-only %s -fexperimental-new-constant-interpreter
4
+ // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s -DCPP98 -fexperimental-new-constant-interpreter
5
+
3
6
4
7
namespace std {
5
8
template <class _E >
You can’t perform that action at this time.
0 commit comments