Implement test/Sema/init.c by treating functions as constants.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43599 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Expr.cpp b/AST/Expr.cpp
index b21aad2..14ef48c 100644
--- a/AST/Expr.cpp
+++ b/AST/Expr.cpp
@@ -382,11 +382,14 @@
if (Loc) *Loc = getLocStart();
return false;
}
- case DeclRefExprClass:
- if (isa<EnumConstantDecl>(cast<DeclRefExpr>(this)->getDecl()))
+ case DeclRefExprClass: {
+ const Decl *D = cast<DeclRefExpr>(this)->getDecl();
+ // Accept address of function.
+ if (isa<EnumConstantDecl>(D) || isa<FunctionDecl>(D))
return true;
if (Loc) *Loc = getLocStart();
return false;
+ }
case UnaryOperatorClass: {
const UnaryOperator *Exp = cast<UnaryOperator>(this);