From: Eli Friedman Date: Tue, 24 Aug 2010 05:23:20 +0000 (+0000) Subject: PR7971: Compute the correct type for an address-of expression containing an X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb3bb31af0bdf25b869d42599133d590cdf8c2c1;p=clang PR7971: Compute the correct type for an address-of expression containing an UnresolvedMemberExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111899 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 46e2745b21..9bff8f3a74 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -6271,7 +6271,7 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) { // FIXME: Can LHS ever be null here? if (!CheckAddressOfOperand(CO->getTrueExpr(), OpLoc).isNull()) return CheckAddressOfOperand(CO->getFalseExpr(), OpLoc); - } else if (isa(op)) { + } else if (isa(op)) { return Context.OverloadTy; } else if (dcl) { // C99 6.5.3.2p1 // We have an lvalue with a decl. Make sure the decl is not declared diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp index f8b00df173..b581b8a3f6 100644 --- a/test/SemaCXX/addr-of-overloaded-function.cpp +++ b/test/SemaCXX/addr-of-overloaded-function.cpp @@ -86,3 +86,13 @@ namespace test0 { myFunction(bar); } } + +namespace PR7971 { + struct S { + void g() { + f(&g); + } + void f(bool (*)(int, char)); + static bool g(int, char); + }; +}