Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/include/clang/Sema/Overload.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ class Sema;

// A function pointer type can be resolved to a member function type,
// which is still an identity conversion.
if (auto *N = T->getAs<MemberPointerType>())
if (auto *N = T->getAs<MemberPointerType>();
N && N->isMemberFunctionPointer())
T = C.getDecayedType(N->getPointeeType());
return T;
};
Expand Down
23 changes: 23 additions & 0 deletions clang/test/SemaCXX/overload-resolution-deferred-templates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,26 @@ void f() {
e.g(&N::f);
}
}

#if __cplusplus >= 201402
namespace PointerToMemData {
struct N {
int field;
};
template <typename It, typename T>
struct B {
B(It, T);
template <typename It2>
B(B<It2, T>);
};
template <typename T>
struct C {
auto g() { return B<int, T>(0, T{}); }
};
void f() {
using T = decltype(C<decltype(&N::field)>{}.g());
}

}

#endif