to268 wrote:

Basically, it is about the way template type parameters are deduced.
The `Ty` template type parameter should be referring to the `int` type in the 
following example:
```cpp
int open() { return 0; }
void close(decltype(open()) *) {}

template <typename Ty>
void test() {
  Ty fd [[gnu::cleanup(close)]] = open(); // error: 'cleanup' function 'close' 
parameter has type 'decltype(open()) *' (aka 'int *') which is incompatible 
with type 'Ty *'
}

int main() {
  test<int>();
}
```
The fix would be to trigger the deduction of the template parameter, which 
should transform the `Ty *` to a `int *` type, which would be a compatible type.
I have heard that the deducing logic is triggered based on a TableGen file, but 
I do not find where would it be.


https://github.com/llvm/llvm-project/pull/164440
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to