[clang] requires bounds after an item declaration are not parsed into RequiresExpr/ConceptSpecializationExpr
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
when taking a look at the ast for the code
```cpp
template void some_fn(T a) requires requires(T val) { { x + x }; };
```
gives the requires expr as a `CXCursor_DeclRefExpr` instead of a `CXCursor_RequiresExpr`, as what would happen with the declaration
```cpp
template requires requires (T x) { x + x } void some_fn(T val);
```
Similarly, for concepts
```cpp
template void some_fn(T a) requires std::is_integral;
```
gives the requires expr as `CXCursor_TemplateRef` rather than a `CXCursor_ConceptSpecializationExpr` as what would happen with the declaration
```cpp
template requires std::is_integral void some_fn(T a);
```
`clang -v --verbose`:
```
Homebrew clang version 22.1.8
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/22.1.8/bin
Configuration file: /opt/homebrew/Cellar/llvm/22.1.8/etc/clang/arm64-apple-darwin23.cfg
System configuration file directory: /opt/homebrew/Cellar/llvm/22.1.8/etc/clang
User configuration file directory: /Users/wutter/.config/clang
```
Contributor guide
Research direction
Start by reproducing the two examples with Clang and inspecting their AST cursor output, comparing trailing requires clauses with requires clauses before the declaration. Trace how the requires expression and concept specialization are represented in the AST, and consider the issue resolved when both forms produce the corresponding CXCursor_RequiresExpr and CXCursor_ConceptSpecializationExpr kinds.
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
- 48/100