From: Douglas Gregor Date: Mon, 25 Oct 2010 20:48:33 +0000 (+0000) Subject: Look through the address-of operator to find the function being X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8f0ade43ee3f9d13d2d98b7a3d07468c2b4096e;p=clang Look through the address-of operator to find the function being called. Fixes another aspect of PR8314. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117308 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 793dc42759..e329ada932 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3769,6 +3769,10 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, } NamedDecl *NDecl = 0; + if (UnaryOperator *UnOp = dyn_cast(NakedFn)) + if (UnOp->getOpcode() == UO_AddrOf) + NakedFn = UnOp->getSubExpr()->IgnoreParens(); + if (isa(NakedFn)) NDecl = cast(NakedFn)->getDecl(); diff --git a/test/Sema/knr-def-call.c b/test/Sema/knr-def-call.c index fc6cfbbd56..b23beb5711 100644 --- a/test/Sema/knr-def-call.c +++ b/test/Sema/knr-def-call.c @@ -37,4 +37,5 @@ void proto(x) void use_proto() { proto(42.0); // expected-warning{{implicit conversion turns floating-point number into integer: 'double' to 'int'}} + (&proto)(42.0); // expected-warning{{implicit conversion turns floating-point number into integer: 'double' to 'int'}} }