From: Douglas Gregor Date: Mon, 30 Mar 2009 21:44:13 +0000 (+0000) Subject: Make PointerUnion3::get work properly X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=2048cdb08ef6ad04bd1baf52886605d455236eb7;p=oota-llvm.git Make PointerUnion3::get work properly git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68067 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/PointerUnion.h b/include/llvm/ADT/PointerUnion.h index 6f5d01af86a..43f5e09cf9e 100644 --- a/include/llvm/ADT/PointerUnion.h +++ b/include/llvm/ADT/PointerUnion.h @@ -193,9 +193,11 @@ namespace llvm { template T get() const { assert(is() && "Invalid accessor called"); - if (Val.is()) - return Val.get(); - return Val.get().get(); + // Is it PT1/PT2? + if (::llvm::getPointerUnionTypeNum((T*)0) != -1) + return Val.get().get(); + + return Val.get(); } /// dyn_cast() - If the current value is of the specified pointer type,