Issue 142118
Summary error: invalid application of 'sizeof' to a function type; with clang++/llvm-20.1.5
Labels clang
Assignees
Reporter peledins-zimperium
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to