r225121 - AST: Remove overzealous assertion from IsModifiable

David Majnemer david.majnemer at gmail.com
Sat Jan 3 16:44:33 PST 2015


Author: majnemer
Date: Sat Jan  3 18:44:32 2015
New Revision: 225121

URL: http://llvm.org/viewvc/llvm-project?rev=225121&view=rev
Log:
AST: Remove overzealous assertion from IsModifiable

It's reasonable to ask if an l-value with class type is modifiable.

Modified:
    cfe/trunk/lib/AST/ExprClassification.cpp
    cfe/trunk/test/SemaCXX/statements.cpp

Modified: cfe/trunk/lib/AST/ExprClassification.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprClassification.cpp?rev=225121&r1=225120&r2=225121&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprClassification.cpp (original)
+++ cfe/trunk/lib/AST/ExprClassification.cpp Sat Jan  3 18:44:32 2015
@@ -615,14 +615,9 @@ static Cl::ModifiableType IsModifiable(A
     return Cl::CM_IncompleteType;
 
   // Records with any const fields (recursively) are not modifiable.
-  if (const RecordType *R = CT->getAs<RecordType>()) {
-    assert((E->getObjectKind() == OK_ObjCProperty ||
-            !Ctx.getLangOpts().CPlusPlus) &&
-           "C++ struct assignment should be resolved by the "
-           "copy assignment operator.");
+  if (const RecordType *R = CT->getAs<RecordType>())
     if (R->hasConstFields())
       return Cl::CM_ConstQualified;
-  }
 
   return Cl::CM_Modifiable;
 }

Modified: cfe/trunk/test/SemaCXX/statements.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/statements.cpp?rev=225121&r1=225120&r2=225121&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/statements.cpp (original)
+++ cfe/trunk/test/SemaCXX/statements.cpp Sat Jan  3 18:44:32 2015
@@ -34,3 +34,6 @@ void test5() {
   char buf[1];
   __asm__ ("":"+r" (buf));
 }
+
+struct MMX_t {};
+void test6() { __asm__("" : "=m"(*(MMX_t *)0)); }





More information about the cfe-commits mailing list