[clang][bytecode] Can't revisit variables with invalid initializers
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Consider:
```c++
struct T {
constexpr int get() const { return 5; }
};
const T &f(const T& t) { return t; }
const T &t = f(T());
static_assert(t.get() == 5);
```
https://godbolt.org/z/7139WMbEx
We revisit `t`, but the initializer is invalid (it's calling a non-constexpr function).
Even with https://github.com/llvm/llvm-project/pull/187918, this doesn't work yet.
Contributor guide
Research direction
Start with the reduced C++ example and reproduce it through the linked Godbolt case, then inspect Clang's bytecode handling for revisiting a variable whose initializer is invalid. Compare the behavior with the changes in PR 187918. Done means the example's static_assert succeeds without treating the non-constexpr initializer as valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100