}
}
- if (!Indices.empty() && !BasePointerType->getElementType()->isSized())
+ SmallPtrSet<const Type*, 4> Visited;
+ if (!Indices.empty() &&
+ !BasePointerType->getElementType()->isSized(&Visited))
return Error(ID.Loc, "base element of getelementptr must be sized");
if (!GetElementPtrInst::getIndexedType(Elts[0]->getType(), Indices))
Indices.push_back(Val);
}
- if (!Indices.empty() && !BasePointerType->getElementType()->isSized())
+ SmallPtrSet<const Type*, 4> Visited;
+ if (!Indices.empty() &&
+ !BasePointerType->getElementType()->isSized(&Visited))
return Error(Loc, "base element of getelementptr must be sized");
if (!GetElementPtrInst::getIndexedType(BaseType, Indices))
--- /dev/null
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+; CHECK: base element of getelementptr must be sized
+
+%myTy = type { %myTy }
+define void @foo(%myTy* %p){
+ %0 = getelementptr %myTy, %myTy* %p, i32 0
+ ret void
+}