@@ -5160,10 +5160,12 @@ ExprResult Sema::ActOnOSSArrayShapingExpr(Expr *Base, ArrayRef<Expr *> Shapes,
5160
5160
5161
5161
if (!Base) {
5162
5162
ErrorFound = true;
5163
- } else if (auto *OASE = dyn_cast<OSSArraySectionExpr>(Base->IgnoreParens())) {
5164
- Diag(OASE->getBeginLoc(), diag::err_oss_array_shaping_use_section)
5165
- << OASE->getSourceRange();
5166
- ErrorFound = true;
5163
+ } else {
5164
+ ExprResult Result = CheckPlaceholderExpr(Base);
5165
+ if (Result.isInvalid()) {
5166
+ Base = Result.get();
5167
+ ErrorFound = true;
5168
+ }
5167
5169
}
5168
5170
5169
5171
for (Expr *const &E : Shapes) {
@@ -5220,20 +5222,31 @@ ExprResult Sema::ActOnOSSArrayShapingExpr(Expr *Base, ArrayRef<Expr *> Shapes,
5220
5222
ErrorFound = true;
5221
5223
}
5222
5224
5225
+ SmallVector<Expr *, 4> NewShapes;
5223
5226
for (int i = Shapes.size() - 1 ; i >= 0; --i) {
5224
- auto Res = PerformOmpSsImplicitIntegerConversion(Shapes[i]->getExprLoc(),
5225
- Shapes[i]);
5227
+ Expr *NewShape = Shapes[i];
5228
+ ExprResult Result = DefaultLvalueConversion(NewShape);
5229
+ if (Result.isInvalid()) {
5230
+ ErrorFound = true;
5231
+ continue;
5232
+ }
5233
+ NewShape = Result.get();
5234
+
5235
+ auto Res = PerformOmpSsImplicitIntegerConversion(NewShape->getExprLoc(),
5236
+ NewShape);
5226
5237
if (Res.isInvalid()) {
5227
5238
ErrorFound = true;
5228
5239
// FIXME: PerformContextualImplicitConversion doesn't always tell us if it
5229
5240
// failed and produced a diagnostic.
5230
5241
// From commit ef6c43dc
5231
- Diag(Shapes[i] ->getExprLoc(), diag::err_oss_typecheck_shape_not_integer)
5232
- << 0 << Shapes[i] ->getSourceRange();
5242
+ Diag(NewShape ->getExprLoc(), diag::err_oss_typecheck_shape_not_integer)
5243
+ << 0 << NewShape ->getSourceRange();
5233
5244
continue;
5234
5245
}
5246
+ NewShape = Res.get();
5247
+ NewShapes.insert(NewShapes.begin(), NewShape);
5235
5248
5236
- Type = BuildArrayType(Type, ArrayType::Normal, Res.get() , /*Quals=*/0,
5249
+ Type = BuildArrayType(Type, ArrayType::Normal, NewShape , /*Quals=*/0,
5237
5250
Shapes[i]->getSourceRange(),
5238
5251
DeclarationName());
5239
5252
if (Type.isNull())
@@ -5251,7 +5264,7 @@ ExprResult Sema::ActOnOSSArrayShapingExpr(Expr *Base, ArrayRef<Expr *> Shapes,
5251
5264
return ExprError();
5252
5265
5253
5266
return OSSArrayShapingExpr::Create(Context, Type,
5254
- VK_LValue, OK_Ordinary, Base, Shapes , LBLoc, RBLoc);
5267
+ VK_LValue, OK_Ordinary, Base, NewShapes , LBLoc, RBLoc);
5255
5268
}
5256
5269
5257
5270
ExprResult Sema::ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc,
0 commit comments