diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-04-14 23:11:21 +0000 | 
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-04-14 23:11:21 +0000 | 
| commit | 064fdb2fe844a4c70fc9b16426433878d78c8298 (patch) | |
| tree | 25296d5b679b53117d73b80ec98918b1d5b2f6ea /clang/lib/Sema/SemaCXXCast.cpp | |
| parent | 1deb972b55c20d14ecdcce3515b4596311fae5b2 (diff) | |
| download | bcm5719-llvm-064fdb2fe844a4c70fc9b16426433878d78c8298.tar.gz bcm5719-llvm-064fdb2fe844a4c70fc9b16426433878d78c8298.zip | |
Always diagnose and complain about problems in
ResolveAddressOfOverloadedFunction when asked to complain. Previously,
we had some weird handshake where ResolveAddressOfOverloadedFunction
expected its caller to handle some of the diagnostics but not others,
and yet there was no way for the caller to know which case we were
in. Eliminate this madness, fixing <rdar://problem/7765884>.
llvm-svn: 101312
Diffstat (limited to 'clang/lib/Sema/SemaCXXCast.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaCXXCast.cpp | 18 | 
1 files changed, 10 insertions, 8 deletions
| diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index 11c8e6ddab5..37df2a60005 100644 --- a/clang/lib/Sema/SemaCXXCast.cpp +++ b/clang/lib/Sema/SemaCXXCast.cpp @@ -809,15 +809,17 @@ TryStaticMemberPointerUpcast(Sema &Self, Expr *&SrcExpr, QualType SrcType,    bool WasOverloadedFunction = false;    DeclAccessPair FoundOverload; -  if (FunctionDecl *Fn -        = Self.ResolveAddressOfOverloadedFunction(SrcExpr, DestType, false, -                                                  FoundOverload)) { -    CXXMethodDecl *M = cast<CXXMethodDecl>(Fn); -    SrcType = Self.Context.getMemberPointerType(Fn->getType(), -                    Self.Context.getTypeDeclType(M->getParent()).getTypePtr()); -    WasOverloadedFunction = true; +  if (SrcExpr->getType() == Self.Context.OverloadTy) { +    if (FunctionDecl *Fn +          = Self.ResolveAddressOfOverloadedFunction(SrcExpr, DestType, false, +                                                    FoundOverload)) { +      CXXMethodDecl *M = cast<CXXMethodDecl>(Fn); +      SrcType = Self.Context.getMemberPointerType(Fn->getType(), +                      Self.Context.getTypeDeclType(M->getParent()).getTypePtr()); +      WasOverloadedFunction = true; +    }    } - +      const MemberPointerType *SrcMemPtr = SrcType->getAs<MemberPointerType>();    if (!SrcMemPtr) {      msg = diag::err_bad_static_cast_member_pointer_nonmp; | 

