[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Sat Mar 22 02:48:40 PDT 2025


mstorsjo wrote:

This change broke building Qt (tested with 6.8), ending up with errors like this:

```
qtbase/src/corelib/kernel/qcoreapplication.cpp:2946:78: error: 'this' cannot be used in a static member function declaration
 2946 |             : slotObject(std::move(slotObject)), context(context ? context : this)
      |                                                                              ^
qtbase/src/corelib/kernel/qobjectdefs_impl.h:405:23: note: in instantiation of template class 'QtPrivate::CallableHelper<void (PermissionReceiver::*)(const QPermission &)>' requested here
  405 |     struct Callable : CallableHelper<Func, Args...>::Type
      |                       ^
qtbase/src/corelib/kernel/qobjectdefs.h:437:38: note: in instantiation of template class 'QtPrivate::Callable<void (PermissionReceiver::*)(const QPermission &)>' requested here
  437 |                  typename QtPrivate::Callable<Func>::ReturnType *ret)
      |                                      ^
qtbase/src/corelib/kernel/qcoreapplication.cpp:2980:13: note: while substituting deduced template arguments into function template 'invokeMethod' [with Func = void (PermissionReceiver::*)(const QPermission &)]
 2980 |             QMetaObject::invokeMethod(receiver,
      |             ^
```

This issue also persists on the latest git main as of right now.

I've reduced the issue down to the following small reproducer:
```c++
template <typename Func> struct CallableHelper {
  static auto Resolve() -> Func;
};
struct QIODevice {
  void d_func() { d_ptr; }
  int d_ptr;
};
struct Callable : CallableHelper<void (QIODevice::*)()> {};
```
Reproducible with e.g. `clang -target x86_64-linux-gnu -c repro.cpp` (presumably the same way for any target).

https://github.com/llvm/llvm-project/pull/132401


More information about the lldb-commits mailing list