-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Open
Labels
Description
This is easily reproducible via clang-repl
, shown below, but the same issue exists for programmatic clang::Interpreter
usage. @vgvassilev for vis.
# Unable to take the address of a static const member.
❯ clang-repl
clang-repl> struct foo{ static int const bar{ 5 }; };
clang-repl> int const *p{ &foo::bar };
clang-repl> #include <cstdio>
clang-repl> printf("%d\n", *p);
JIT session error: Symbols not found: [ _ZN3foo3barE ]
Segmentation fault (core dumped)
# Getting its value works fine.
❯ clang-repl
clang-repl> struct foo{ static int const bar{ 5 }; };
clang-repl> int const i{ foo::bar };
clang-repl> #include <cstdio>
clang-repl> printf("%d\n", i);
5
❯ clang-repl --version
LLVM (http://llvm.org/):
LLVM version 19.1.7
Optimized build.
I have verified this bug exists on versions:
- 19.1.7
- 20.1.5