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

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 29 10:34:15 PDT 2025


gulfemsavrun wrote:

We started seeing the following issue, and bisected to this commit.
```
test.cpp:8:12: error: no matching function for call to 'GetFieldChecked'
    8 |     return GetFieldChecked(b, &std::remove_reference<decltype(b)>::type::has_total);
      |            ^~~~~~~~~~~~~~~
test.cpp:6:5: note: candidate template ignored: deduced conflicting types for parameter 'Table' ('Bar' vs. 'const Bar')
    6 | int GetFieldChecked(const Table&, bool (Table::*)() const);
      |     ^
1 error generate
```

Here's a small test case:
```
#include <type_traits>
struct Bar {
  bool has_total() const;
};
template <typename Table>
int GetFieldChecked(const Table&, bool (Table::*)() const);
int foo(const Bar& b) { 
    return GetFieldChecked(b, &std::remove_reference<decltype(b)>::type::has_total);
}
```

If we just compile it via `clang++ -c test.cpp` with this commit, we ran into this issue and it is blocking us to roll Clang in our project.


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


More information about the cfe-commits mailing list