Index: include/llvm/ADT/PointerUnion.h =================================================================== --- include/llvm/ADT/PointerUnion.h +++ include/llvm/ADT/PointerUnion.h @@ -158,7 +158,7 @@ assert( get() == Val.getPointer() && "Can't get the address because PointerLikeTypeTraits changes the ptr"); - return (PT1 *)Val.getAddrOfPointer(); + return const_cast((const PT1 *)Val.getAddrOfPointer()); } /// Assignment from nullptr which just clears the union.