Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions clang/include/clang/Sema/Overload.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,14 @@ class Sema;
if (!ReferenceBinding) {
#ifndef NDEBUG
auto Decay = [&](QualType T) {
return (T->isArrayType() || T->isFunctionType()) ? C.getDecayedType(T)
: T;
T = (T->isArrayType() || T->isFunctionType()) ? C.getDecayedType(T)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's not a single expression any more, a simple if would be a bit nicer here, IMO.

: T;

// A function pointer type can be resolved to a member function type,
// which is still an identity conversion.
if (auto *N = T->getAs<MemberPointerType>())
T = C.getDecayedType(N->getPointeeType());
return T;
};
// The types might differ if there is an array-to-pointer conversion
// an function-to-pointer conversion, or lvalue-to-rvalue conversion.
Expand Down
19 changes: 19 additions & 0 deletions clang/test/SemaCXX/overload-resolution-deferred-templates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,22 @@ struct InitListAreNotPerfectCpy {
};

InitListAreNotPerfectCpy InitListAreNotPerfectCpy_test({InitListAreNotPerfectCpy{}});

namespace PointerToMemFunc {
template <typename>
class A;
struct N {
template <typename T>
void f(T);
};
template <typename T>
struct E {
template <class = A<int>>
void g() = delete;
void g(void (T::*)(char));
};
void f() {
E<N> e;
e.g(&N::f);
}
}