]> granicus.if.org Git - clang/commitdiff
Look through the address-of operator to find the function being
authorDouglas Gregor <dgregor@apple.com>
Mon, 25 Oct 2010 20:48:33 +0000 (20:48 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 25 Oct 2010 20:48:33 +0000 (20:48 +0000)
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
test/Sema/knr-def-call.c

index 793dc42759b05c88d4251cfd564c0a007d7f7d86..e329ada93221dee230a8840ee6d8c2842102389c 100644 (file)
@@ -3769,6 +3769,10 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
   }
 
   NamedDecl *NDecl = 0;
+  if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(NakedFn))
+    if (UnOp->getOpcode() == UO_AddrOf)
+      NakedFn = UnOp->getSubExpr()->IgnoreParens();
+  
   if (isa<DeclRefExpr>(NakedFn))
     NDecl = cast<DeclRefExpr>(NakedFn)->getDecl();
 
index fc6cfbbd5623f4aebea777a0942cdd56e099e003..b23beb57114b64162bf42da61caa954cd556056c 100644 (file)
@@ -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'}}
 }