diff --git a/include/Support/Casting.h b/include/Support/Casting.h index 2c072d1bb44..e0d50fe5d55 100644 --- a/include/Support/Casting.h +++ b/include/Support/Casting.h @@ -71,7 +71,7 @@ struct isa_impl_cl { template static bool isa(const FromCl &Val) { return isa_impl_wrap::SimpleType>::doit(Val); + typename simplify_type::SimpleType>::doit(Val); } }; @@ -153,7 +153,7 @@ struct cast_retty_wrap { template struct cast_retty { typedef typename cast_retty_wrap::SimpleType>::ret_type ret_type; + typename simplify_type::SimpleType>::ret_type ret_type; }; // Ensure the non-simple values are converted using the simplify_type template @@ -161,17 +161,17 @@ struct cast_retty { // template struct cast_convert_val { // This is not a simple type, use the template to simplify it... - static cast_retty::ret_type doit(const From &Val) { + static typename cast_retty::ret_type doit(const From &Val) { return cast_convert_val::SimpleType>::doit( + typename simplify_type::SimpleType>::doit( simplify_type::getSimplifiedValue(Val)); } }; template struct cast_convert_val { // This _is_ a simple type, just cast it. - static cast_retty::ret_type doit(const FromTy &Val) { - return (cast_retty::ret_type)Val; + static typename cast_retty::ret_type doit(const FromTy &Val) { + return (typename cast_retty::ret_type)Val; } }; @@ -185,16 +185,17 @@ template struct cast_convert_val { // cast(myVal)->getParent() // template -inline cast_retty::ret_type cast(const Y &Val) { +inline typename cast_retty::ret_type cast(const Y &Val) { assert(isa(Val) && "cast() argument of uncompatible type!"); - return cast_convert_val::SimpleType>::doit(Val); + return cast_convert_val::SimpleType>::doit(Val); } // cast_or_null - Functionally identical to cast, except that a null value is // accepted. // template -inline cast_retty::ret_type cast_or_null(Y *Val) { +inline typename cast_retty::ret_type cast_or_null(Y *Val) { if (Val == 0) return 0; assert(isa(Val) && "cast_or_null() argument of uncompatible type!"); return cast(Val); @@ -210,7 +211,7 @@ inline cast_retty::ret_type cast_or_null(Y *Val) { // template -inline cast_retty::ret_type dyn_cast(Y *Val) { +inline typename cast_retty::ret_type dyn_cast(Y *Val) { return isa(Val) ? cast(Val) : 0; } @@ -218,7 +219,7 @@ inline cast_retty::ret_type dyn_cast(Y *Val) { // value is accepted. // template -inline cast_retty::ret_type dyn_cast_or_null(Y *Val) { +inline typename cast_retty::ret_type dyn_cast_or_null(Y *Val) { return (Val && isa(Val)) ? cast(Val) : 0; } diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h index 2c072d1bb44..e0d50fe5d55 100644 --- a/include/llvm/Support/Casting.h +++ b/include/llvm/Support/Casting.h @@ -71,7 +71,7 @@ struct isa_impl_cl { template static bool isa(const FromCl &Val) { return isa_impl_wrap::SimpleType>::doit(Val); + typename simplify_type::SimpleType>::doit(Val); } }; @@ -153,7 +153,7 @@ struct cast_retty_wrap { template struct cast_retty { typedef typename cast_retty_wrap::SimpleType>::ret_type ret_type; + typename simplify_type::SimpleType>::ret_type ret_type; }; // Ensure the non-simple values are converted using the simplify_type template @@ -161,17 +161,17 @@ struct cast_retty { // template struct cast_convert_val { // This is not a simple type, use the template to simplify it... - static cast_retty::ret_type doit(const From &Val) { + static typename cast_retty::ret_type doit(const From &Val) { return cast_convert_val::SimpleType>::doit( + typename simplify_type::SimpleType>::doit( simplify_type::getSimplifiedValue(Val)); } }; template struct cast_convert_val { // This _is_ a simple type, just cast it. - static cast_retty::ret_type doit(const FromTy &Val) { - return (cast_retty::ret_type)Val; + static typename cast_retty::ret_type doit(const FromTy &Val) { + return (typename cast_retty::ret_type)Val; } }; @@ -185,16 +185,17 @@ template struct cast_convert_val { // cast(myVal)->getParent() // template -inline cast_retty::ret_type cast(const Y &Val) { +inline typename cast_retty::ret_type cast(const Y &Val) { assert(isa(Val) && "cast() argument of uncompatible type!"); - return cast_convert_val::SimpleType>::doit(Val); + return cast_convert_val::SimpleType>::doit(Val); } // cast_or_null - Functionally identical to cast, except that a null value is // accepted. // template -inline cast_retty::ret_type cast_or_null(Y *Val) { +inline typename cast_retty::ret_type cast_or_null(Y *Val) { if (Val == 0) return 0; assert(isa(Val) && "cast_or_null() argument of uncompatible type!"); return cast(Val); @@ -210,7 +211,7 @@ inline cast_retty::ret_type cast_or_null(Y *Val) { // template -inline cast_retty::ret_type dyn_cast(Y *Val) { +inline typename cast_retty::ret_type dyn_cast(Y *Val) { return isa(Val) ? cast(Val) : 0; } @@ -218,7 +219,7 @@ inline cast_retty::ret_type dyn_cast(Y *Val) { // value is accepted. // template -inline cast_retty::ret_type dyn_cast_or_null(Y *Val) { +inline typename cast_retty::ret_type dyn_cast_or_null(Y *Val) { return (Val && isa(Val)) ? cast(Val) : 0; }