[cfe-commits] r57941 - /cfe/trunk/lib/AST/Expr.cpp
Douglas Gregor
doug.gregor at gmail.com
Tue Oct 21 17:03:08 PDT 2008
Author: dgregor
Date: Tue Oct 21 19:03:08 2008
New Revision: 57941
URL: http://llvm.org/viewvc/llvm-project?rev=57941&view=rev
Log:
Functions can be lvalues in C++, but not modifiable lvalues
Modified:
cfe/trunk/lib/AST/Expr.cpp
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=57941&r1=57940&r2=57941&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue Oct 21 19:03:08 2008
@@ -422,7 +422,13 @@
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;
More information about the cfe-commits
mailing list