]> granicus.if.org Git - clang/commitdiff
AST: Remove overzealous assertion from IsModifiable
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 4 Jan 2015 00:44:32 +0000 (00:44 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 4 Jan 2015 00:44:32 +0000 (00:44 +0000)
It's reasonable to ask if an l-value with class type is modifiable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225121 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprClassification.cpp
test/SemaCXX/statements.cpp

index 915ca161c919c1550317d22c00b2a196a1140b3b..933ea97fa2babfe50e96be6e19968e7b2020c1bf 100644 (file)
@@ -615,14 +615,9 @@ static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E,
     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;
 }
index efca37dcba1297aa2b9d1918c0417f990c6f308d..15b0b50ddc75240c3158c4e6f35edc0fbac8b5f6 100644 (file)
@@ -34,3 +34,6 @@ void test5() {
   char buf[1];
   __asm__ ("":"+r" (buf));
 }
+
+struct MMX_t {};
+void test6() { __asm__("" : "=m"(*(MMX_t *)0)); }