[flang] Detect fir.class nested in fir.box as invalid element type
Catch invalid element type in fir.box in the verifier so it does not propagate later in lowering. Reviewed By: PeteSteinfeld Differential Revision: https://reviews.llvm.org/D146078
This commit is contained in:
parent
4e3608bf29
commit
94d9b7ce60
|
@ -456,6 +456,8 @@ static bool cannotBePointerOrHeapElementType(mlir::Type eleTy) {
|
|||
mlir::LogicalResult
|
||||
fir::BoxType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
|
||||
mlir::Type eleTy) {
|
||||
if (eleTy.isa<fir::BaseBoxType>())
|
||||
return emitError() << "invalid element type\n";
|
||||
// TODO
|
||||
return mlir::success();
|
||||
}
|
||||
|
|
|
@ -167,3 +167,8 @@ func.func private @oth3() -> !fir.vector<10:>
|
|||
|
||||
// expected-error@+1 {{invalid element type}}
|
||||
func.func private @upe() -> !fir.class<!fir.box<i32>>
|
||||
|
||||
// -----
|
||||
|
||||
// expected-error@+1 {{invalid element type}}
|
||||
func.func private @upe() -> !fir.box<!fir.class<none>>
|
||||
|
|
Loading…
Reference in New Issue
Block a user