<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/129631>129631</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] the "cleanup" attribute prevents type deduction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
shynur
</td>
</tr>
</table>
<pre>
```cpp
/* a.cpp */
int open() { return 0; }
void close(decltype(open()) *) {}
int main() {
auto fd [[gnu::cleanup(close)]] = open();
}
```
```bash
$ clang-21 a.cpp
a.cpp:4:26: error: 'cleanup' function 'close' parameter has type 'decltype(open()) *' (aka 'int *') which is incompatible with type 'auto *'
4 | auto fd [[gnu::cleanup(close)]] = open();
| ^
1 error generated.
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysk0uu4yoQhldTnpROhMHPgQfOzc0-MK7YdBNs8chRdt8CRzkZ9aijSLz8_1X1FUjv9WKJBqjPUF8KGcO6ucGvTxtdMW3zc4CGHX-178BG4FfgI8qT2ncEntds1DbgtpMF3gHvEdozOgrRWWQgzgjtBdj42PSMymyegHczKROee5r-CLM2eWaLQ5Ws71J_WAMbEWUMG95mzImfFxtBjCBGZUjauAPvXoF6qC9QXxDE5SNDEMnlCPAuMM0_lpP0ay64QmWkXb54eZQNbDxGMVYgRt6AGJGc21yaAG_fSbR4i1YFvdljO2fU4i6dvFMgh6v0mCik478TaRF4J3_L9GVCcmym4-9VqxW1R23Vdt9l0JMh_NZhfVtnWC9FgodYIbT_4b_BiPmX_KD-H9hYHjBwIUtOBppPn1iLeRBzL3pZ0FC2Vcnqpq7bYh0a1bd9JXs5yxubqRPz1FKn-vomb82t6ws9cMZrJljFeNWX7alVYiobJaZadl3ZNVAxukttTsY87qfNLYX2PtJQ8r4RZWHkRMbnq855bilwnm69G5Lga4qLh4oZ7YP_sQg6mPw-DkV9wbAmqPzNiKMMwekpBsLd0YNseHV1pjnm9hfRmWENYfeJb3pC10WHNU4ntd2BX1O01_C1u-0XqQD8mrP3wK-vAh4D_xMAAP__gP4SUg">