Regression when evaluating constant expression in dependent types
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
In c++20, the following program used to be compiled successfully in gcc and msvc but rejected in clang. But from C++23, clang also started accepted the program. Seems like a regression: [Demo](https://godbolt.org/z/vW7f3PEos)
```cpp
template
struct s{
constexpr static int n = N;
};
template
void test(T& t){
static_assert(t.n == 1);
}
int main(){
s<1> str;
test(str);
}
```
C++20's clang rejected this but C++23's clang accepts this.
Contributor guide
Research direction
Start with the linked Godbolt reproduction and compare Clang's C++20 and C++23 behavior for the dependent-type constant expression. Trace the relevant Clang constant-expression and dependent-type handling to identify the regression or standards change; done means the differing behavior is explained and a focused compiler regression test can be identified.
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