File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -1883,8 +1883,10 @@ llvm::Constant *ConstantEmitter::tryEmitPrivateForVarInit(const VarDecl &D) {
18831883
18841884 // Try to emit the initializer. Note that this can allow some things that
18851885 // are not allowed by tryEmitPrivateForMemory alone.
1886- if (APValue *value = D.evaluateValue ())
1887- return tryEmitPrivateForMemory (*value, destType);
1886+ if (APValue *value = D.evaluateValue ()) {
1887+ if (!value->allowConstexprUnknown ())
1888+ return tryEmitPrivateForMemory (*value, destType);
1889+ }
18881890
18891891 return nullptr ;
18901892}
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++23 %s -emit-llvm -o - | FileCheck %s
2+
3+ extern int & s;
4+
5+ // CHECK: @_Z4testv()
6+ // CHECK-NEXT: entry:
7+ // CHECK-NEXT: [[I:%.*]] = alloca ptr, align {{.*}}
8+ // CHECK-NEXT: [[X:%.*]] = load ptr, ptr @s, align {{.*}}
9+ // CHECK-NEXT: store ptr [[X]], ptr [[I]], align {{.*}}
10+ int & test () {
11+ auto &i = s;
12+ return i;
13+ }
You can’t perform that action at this time.
0 commit comments