diff options
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 54723369002..53a4a4c7834 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -4395,8 +4395,13 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, if (VK != VK_RValue) OK = OK_VectorComponent; - // FIXME: need to deal with const... ResultType = VTy->getElementType(); + QualType BaseType = BaseExpr->getType(); + Qualifiers BaseQuals = BaseType.getQualifiers(); + Qualifiers MemberQuals = ResultType.getQualifiers(); + Qualifiers Combined = BaseQuals + MemberQuals; + if (Combined != MemberQuals) + ResultType = Context.getQualifiedType(ResultType, Combined); } else if (LHSTy->isArrayType()) { // If we see an array that wasn't promoted by // DefaultFunctionArrayLvalueConversion, it must be an array that @@ -10434,8 +10439,16 @@ static void DiagnoseConstAssignment(Sema &S, const Expr *E, // Static fields do not inherit constness from parents. break; } - break; - } // End MemberExpr + break; // End MemberExpr + } else if (const ArraySubscriptExpr *ASE = + dyn_cast<ArraySubscriptExpr>(E)) { + E = ASE->getBase()->IgnoreParenImpCasts(); + continue; + } else if (const ExtVectorElementExpr *EVE = + dyn_cast<ExtVectorElementExpr>(E)) { + E = EVE->getBase()->IgnoreParenImpCasts(); + continue; + } break; } |

