Author: efriedma
Date: Fri Dec 25 21:35:45 2009
New Revision: 92166

URL: http://llvm.org/viewvc/llvm-project?rev=92166&view=rev
Log:
Don't look through casts when looking for the underlying decl for a function
call; the standard doesn't expect us to, and the program could be doing
something crazy.  Fixes PR5882.


Added:
    cfe/trunk/test/CodeGen/func-ptr-cast-decl.c
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=92166&r1=92165&r2=92166&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Dec 25 21:35:45 2009
@@ -3373,7 +3373,7 @@
   // Also, in C++, keep track of whether we should perform argument-dependent
   // lookup and whether there were any explicitly-specified template arguments.
 
-  Expr *NakedFn = Fn->IgnoreParenCasts();
+  Expr *NakedFn = Fn->IgnoreParens();
   if (isa<UnresolvedLookupExpr>(NakedFn)) {
     UnresolvedLookupExpr *ULE = cast<UnresolvedLookupExpr>(NakedFn);
     return BuildOverloadedCallExpr(Fn, ULE, LParenLoc, Args, NumArgs,

Added: cfe/trunk/test/CodeGen/func-ptr-cast-decl.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/func-ptr-cast-decl.c?rev=92166&view=auto

==============================================================================
--- cfe/trunk/test/CodeGen/func-ptr-cast-decl.c (added)
+++ cfe/trunk/test/CodeGen/func-ptr-cast-decl.c Fri Dec 25 21:35:45 2009
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -emit-llvm-only %s -verify
+// PR5882
+
+int q_sk_num(void *a);
+typedef int (*fptr)(double);
+void a() { ((fptr)q_sk_num)(0); }


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to