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>
25102510bool ByteCodeExprGen<Emitter>::visitDecl(const VarDecl *VD) {
25112511 assert (!VD->isInvalidDecl () && " Trying to constant evaluate an invalid decl" );
25122512
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+
25132519 // Create and initialize the variable.
25142520 if (!this ->visitVarDecl (VD))
25152521 return false ;
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -std=c++11 -verify -emit-llvm-only %s
22// 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+
36
47namespace std {
58 template <class _E >
You can’t perform that action at this time.
0 commit comments