From 63f067f5a75ae97b53dc7a6a6530e2c72c8bb7f8 Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Fri, 4 Apr 2008 09:45:30 +0000 Subject: [PATCH] PR1963: Address of function is a constant expression git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49212 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Expr.cpp | 2 ++ test/Sema/address-constant.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 11fcc419a5..5205702f29 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -453,6 +453,8 @@ bool Expr::hasGlobalStorage() const { const Decl *D = cast(this)->getDecl(); if (const VarDecl *VD = dyn_cast(D)) return VD->hasGlobalStorage(); + if (isa(D)) + return true; return false; } case MemberExprClass: { diff --git a/test/Sema/address-constant.c b/test/Sema/address-constant.c index 0b451cc39c..e1704b8b0e 100644 --- a/test/Sema/address-constant.c +++ b/test/Sema/address-constant.c @@ -5,3 +5,6 @@ int a[] = {0}; struct { int i; } s; int *array[] = {&i, a, &s.i}; + +extern void f(void); +void (*f_addr)(void) = &f;