[clangd] [Signature help] [C++23] Parameter hints do not appear for static operator (and some obscure interaction with templates)
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
In the following example code I do not get any parameter hints for the operator, but if I manually type in `true` clangd recognizes that I am calling the operator.
```
struct Abc {
static void operator()(bool a) {}
};
void test() {
Abc abc;
abc(^);
}
```
If I remove the `static` from the operator definition I do get the paramtere hints.
```
struct Abc {
void operator()(bool a) {}
};
void test() {
Abc abc;
abc(^);
}
```
As straight forward as this bug seems to be, I stumbled upon some more odd behaviour. Consider now me using 2 parameters, this still does not work with static as you can see here.
```
struct Abc {
static void operator()(bool a, bool b) {}
};
void test() {
Abc abc;
abc(^);
}
```
But if I now template my operator it does work.
```
struct Abc {
template
static void operator()(T a, bool b) {}
};
void test() {
Abc abc;
abc(^);
}
```
The odd part here is that I **need** 2 parameters for my operator, because the templated version with only 1 parameter does **not** work.
```
struct Abc {
template
static void operator()(T a) {}
};
void test() {
Abc abc;
abc(^);
}
```
Also it is important that the template type is used in the parameters, otherwise it does **not** work.
```
struct Abc {
template
static void operator()(bool a, bool b) { T c; }
};
void test() {
Abc abc;
abc(^);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.