fix PR 3222: allow one to get the address of a global function in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61111 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index affe2ae2..cdaa2fc 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2889,7 +2889,7 @@
}
NamedDecl *dcl = getPrimaryDecl(op);
Expr::isLvalueResult lval = op->isLvalue(Context);
-
+ printf("oleee\n");
if (lval != Expr::LV_Valid) { // C99 6.5.3.2p1
if (!dcl || !isa<FunctionDecl>(dcl)) {// allow function designators
// FIXME: emit more specific diag...
@@ -2922,8 +2922,10 @@
return Context.OverloadTy;
} else if (isa<FieldDecl>(dcl)) {
// Okay: we can take the address of a field.
+ } else if (isa<FunctionDecl>(dcl)) {
+ // Okay: we can take the address of a function.
}
- else
+ else
assert(0 && "Unknown/unexpected decl type");
}