<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/142118>142118</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
error: invalid application of 'sizeof' to a function type; with clang++/llvm-20.1.5
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
peledins-zimperium
</td>
</tr>
</table>
<pre>
Repro:
```
% cat a.cpp
#include <memory>
struct B;
void deleter(B *){};
struct A
{
A() : handle(nullptr,deleter) {}
std::unique_ptr<B, void (&)(B*)> handle;
};
int main()
{
A a;
}
% /opt/homebrew/Cellar/llvm@19/19.1.7/bin/clang++ ./a.cpp
# --> OK
% /opt/homebrew/Cellar/llvm/20.1.5/bin/clang++ ./a.cpp
In file included from ./a.cpp:1:
In file included from /opt/homebrew/Cellar/llvm/20.1.5/bin/../include/c++/v1/memory:947:
In file included from /opt/homebrew/Cellar/llvm/20.1.5/bin/../include/c++/v1/__memory/inout_ptr.h:16:
In file included from /opt/homebrew/Cellar/llvm/20.1.5/bin/../include/c++/v1/__memory/shared_ptr.h:30:
/opt/homebrew/Cellar/llvm/20.1.5/bin/../include/c++/v1/__memory/compressed_pair.h:68:57: error: invalid application of 'sizeof' to a function type
68 | is_reference<_ToPad>::value || sizeof(_ToPad) == __datasizeof_v<_ToPad>)>
| ^~~~~~~~~~~~~~
/opt/homebrew/Cellar/llvm/20.1.5/bin/../include/c++/v1/__memory/unique_ptr.h:162:3: note: in instantiation of default argument for '__compressed_pair_padding<deleter_type>' required here
162 | _LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/llvm/20.1.5/bin/../include/c++/v1/__memory/compressed_pair.h:80:38: note: expanded from macro '_LIBCPP_COMPRESSED_PAIR'
80 | _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./a.cpp:7:38: note: in instantiation of template class 'std::unique_ptr<B, void (&)(B *)>' requested here
7 | std::unique_ptr<B, void (&)(B*)> handle;
| ^
1 error generated.
```
19.1.7 seems to be working, 20.1.5.-no.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVk2T2zYM_TXwBbMairQ-fPBBlq2ZnaabbT7OGlqCbbaSqJCU0-TQ396hJHu9aZpJ06bR-CCLIPD4gAdQWquOHdEaog1E24Uc3EmbdU8N1aqzdx9V25NRQ7vY6_rD-hX1RoPIgGUQs_nHMuARVtKhDKq-H_8L1VXNUBOCyFtqtfkAYgcss84MlcMNiA2w7KxVjTU15MgATzcIPAO-gmQDyXYymTeMERP_ATPgKfAVgsjwJLu6IeBpNzRN7wzw_OpuhbMfliEiWld74CIbOvVuoNJbi3wDPMcRxug19tF5uplxiN0lwojlCgpYpjqHrVTdBOYJHSJmKJ_sJ3KAF7p3wIuTbmlv6D3wIqemkQZ40TTnFpYsXAEvwlUQBgnwYu9dF1UjuyPwDfANBsCLG4Lx7s7je_nTV4fgBWdBGERf9o63D7DsvsODagjnhNZ4MLq9ASOycCqIzxt-A6zAO5-9eJQTQuDFOQReXKopWy2T_zVwWc6hvY0enK-g4OTPH_8oHPYkDdVXIILN0vyOISvd9oas9WGlmuLGKYgs8tlAMkYb_6K6s2xUjbLvG1VJp3SH-oDAE6s-kj4AT9BplHgYumpcdR96mhQUpwhJjsqWhg5kqKsIRF6-0Y-y9m1klPFZNgN5O2968ZnORmN72ILYYlnW0slpvTw_czMKfNYsjhEh2v1x-3xnLp860VxH3CfRs9dpRxOLqDrrZOfUlcKaDnJoHEpzHFrqHB608byW5Se5KXtZ16o7grg0xXLk2B89QUPvBmWoxhOZifcw5iML5Yv7Tf74WOY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