[cfe-commits] r49212 - in /cfe/trunk: lib/AST/Expr.cpp test/Sema/address-constant.c
Seo Sanghyeon
sanxiyn at gmail.com
Fri Apr 4 02:45:32 PDT 2008
Author: sanxiyn
Date: Fri Apr 4 04:45:30 2008
New Revision: 49212
URL: http://llvm.org/viewvc/llvm-project?rev=49212&view=rev
Log:
PR1963: Address of function is a constant expression
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/test/Sema/address-constant.c
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=49212&r1=49211&r2=49212&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Fri Apr 4 04:45:30 2008
@@ -453,6 +453,8 @@
const Decl *D = cast<DeclRefExpr>(this)->getDecl();
if (const VarDecl *VD = dyn_cast<VarDecl>(D))
return VD->hasGlobalStorage();
+ if (isa<FunctionDecl>(D))
+ return true;
return false;
}
case MemberExprClass: {
Modified: cfe/trunk/test/Sema/address-constant.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/address-constant.c?rev=49212&r1=49211&r2=49212&view=diff
==============================================================================
--- cfe/trunk/test/Sema/address-constant.c (original)
+++ cfe/trunk/test/Sema/address-constant.c Fri Apr 4 04:45:30 2008
@@ -5,3 +5,6 @@
struct { int i; } s;
int *array[] = {&i, a, &s.i};
+
+extern void f(void);
+void (*f_addr)(void) = &f;
More information about the cfe-commits
mailing list