llvm::Constant *Idx0 = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
llvm::Value *Ops[] = {Idx0, Idx0};
- return Builder.CreateGEP(V, Ops, Ops+2, "arraydecay");
+ V = Builder.CreateGEP(V, Ops, Ops+2, "arraydecay");
+
+ // The resultant pointer type can be implicitly casted to other pointer
+ // types as well, for example void*.
+ const llvm::Type *DestPTy = ConvertType(E->getType());
+ assert(isa<llvm::PointerType>(DestPTy) &&
+ "Only expect implicit cast to pointer");
+ if (V->getType() != DestPTy)
+ V = Builder.CreateBitCast(V, DestPTy, "ptrconv");
+ return V;
+
} else if (E->getType()->isReferenceType()) {
assert(cast<ReferenceType>(E->getType().getCanonicalType())->
getReferenceeType() ==
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
projectDirPath = "";
--- /dev/null
+// RUN: clang %s -emit-llvm
+
+extern void go(const void *p);
+float v[2] = { 0.0, 1.0 };
+void foo(void) { go(v); }
+