From d8f0ade43ee3f9d13d2d98b7a3d07468c2b4096e Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 25 Oct 2010 20:48:33 +0000 Subject: [PATCH] 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 --- lib/Sema/SemaExpr.cpp | 4 ++++ test/Sema/knr-def-call.c | 1 + 2 files changed, 5 insertions(+) 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'}} } -- 2.40.0