Issue |
146956
|
Summary |
`clang::Interpreter` cannot get the address of a static const member
|
Labels |
clang
|
Assignees |
|
Reporter |
jeaye
|
This is easily reproducible via `clang-repl`, but the same issue exists for programmatic `clang::Interpreter` usage. @vgvassilev for vis.
```sh
# 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
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs