title: Invalid constantexpr bitcast
body: <p>I'm trying to get the i8 pointer to a constant struct using bitcast, but get this error:</p>
  
  <pre><code>llvm_test: Constants.cpp:1811: static llvm::Constant*
  llvm::ConstantExpr::getBitCast(llvm::Constant*, llvm::Type*, bool): 
  Assertion `CastInst::castIsValid(Instruction::BitCast, C, DstTy) &amp;&amp; 
  "Invalid constantexpr bitcast!"' failed.
  </code></pre>
  
  <p>I'm not sure what I'm doing wrong, the code is very basic (in OCaml):</p>
  
  <pre><code>let const = const_struct llctx [|const_int i32_t 1;|] in
  let ptr = const_bitcast const i8_ptr_t in  &lt;--- Explodes here
  </code></pre>
  
  <p>Any ideas?</p>