Timm Baeder 8e2dbab242
[clang][bytecode] Fix defining extern variables (#108940)
At the point of defintion of the variable, a function might already
refert to the variable by its index. Replace the index with the new one.
2024-09-17 15:21:28 +02:00

14 lines
254 B
C++

// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=both,expected %s
// RUN: %clang_cc1 -verify=both,ref %s
// both-no-diagnostics
extern const int E;
constexpr int getE() {
return E;
}
const int E = 10;
static_assert(getE() == 10);