diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-10-22 00:03:08 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-10-22 00:03:08 +0000 |
commit | ae8d467e75a4e72b19e1eca199bf93dfaab47acf (patch) | |
tree | cffea453fa53b218fdeded0de8908431af233ab8 | |
parent | d46075f8c34bb6f4571036786fdfaf3564fd2653 (diff) |
Functions can be lvalues in C++, but not modifiable lvalues
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57941 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/Expr.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index d957e33aa1..4fd8a24c8a 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -422,7 +422,13 @@ Expr::isModifiableLvalueResult Expr::isModifiableLvalue(ASTContext &Ctx) const { isLvalueResult lvalResult = isLvalue(Ctx); switch (lvalResult) { - case LV_Valid: break; + case LV_Valid: + // C++ 3.10p11: Functions cannot be modified, but pointers to + // functions can be modifiable. + if (Ctx.getLangOptions().CPlusPlus && TR->isFunctionType()) + return MLV_NotObjectType; + break; + case LV_NotObjectType: return MLV_NotObjectType; case LV_IncompleteVoidType: return MLV_IncompleteVoidType; case LV_DuplicateVectorComponents: return MLV_DuplicateVectorComponents; |