diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index 87fecd287aa..d2af2ba3e89 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -5024,7 +5024,7 @@ eval_enumerators_of (location_t loc, const constexpr_ctx *ctx, tree r, static tree eval_remove_const (location_t loc, tree type) { - return get_reflection_raw (loc, strip_typedefs (remove_const (type))); + return get_reflection_raw (loc, remove_const (strip_typedefs (type))); } /* Process std::meta::remove_volatile. @@ -5035,10 +5035,10 @@ eval_remove_const (location_t loc, tree type) static tree eval_remove_volatile (location_t loc, tree type) { + type = strip_typedefs (type); int quals = cp_type_quals (type); quals &= ~TYPE_QUAL_VOLATILE; type = cp_build_qualified_type (type, quals); - type = strip_typedefs (type); return get_reflection_raw (loc, type); } @@ -5050,8 +5050,8 @@ eval_remove_volatile (location_t loc, tree type) static tree eval_remove_cv (location_t loc, tree type) { - type = finish_trait_type (CPTK_REMOVE_CV, type, NULL_TREE, tf_none); type = strip_typedefs (type); + type = finish_trait_type (CPTK_REMOVE_CV, type, NULL_TREE, tf_none); return get_reflection_raw (loc, type); } @@ -5063,13 +5063,13 @@ eval_remove_cv (location_t loc, tree type) static tree eval_add_const (location_t loc, tree type) { + type = strip_typedefs (type); if (!TYPE_REF_P (type) && !FUNC_OR_METHOD_TYPE_P (type)) { int quals = cp_type_quals (type); quals |= TYPE_QUAL_CONST; type = cp_build_qualified_type (type, quals); } - type = strip_typedefs (type); return get_reflection_raw (loc, type); } @@ -5081,13 +5081,13 @@ eval_add_const (location_t loc, tree type) static tree eval_add_volatile (location_t loc, tree type) { + type = strip_typedefs (type); if (!TYPE_REF_P (type) && !FUNC_OR_METHOD_TYPE_P (type)) { int quals = cp_type_quals (type); quals |= TYPE_QUAL_VOLATILE; type = cp_build_qualified_type (type, quals); } - type = strip_typedefs (type); return get_reflection_raw (loc, type); } @@ -5099,13 +5099,13 @@ eval_add_volatile (location_t loc, tree type) static tree eval_add_cv (location_t loc, tree type) { + type = strip_typedefs (type); if (!TYPE_REF_P (type) && !FUNC_OR_METHOD_TYPE_P (type)) { int quals = cp_type_quals (type); quals |= (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE); type = cp_build_qualified_type (type, quals); } - type = strip_typedefs (type); return get_reflection_raw (loc, type); } @@ -5131,8 +5131,8 @@ eval_remove_reference (location_t loc, tree type) static tree eval_add_lvalue_reference (location_t loc, tree type) { - type = finish_trait_type (CPTK_ADD_LVALUE_REFERENCE, type, NULL_TREE, tf_none); type = strip_typedefs (type); + type = finish_trait_type (CPTK_ADD_LVALUE_REFERENCE, type, NULL_TREE, tf_none); return get_reflection_raw (loc, type); } @@ -5144,8 +5144,8 @@ eval_add_lvalue_reference (location_t loc, tree type) static tree eval_add_rvalue_reference (location_t loc, tree type) { - type = finish_trait_type (CPTK_ADD_RVALUE_REFERENCE, type, NULL_TREE, tf_none); type = strip_typedefs (type); + type = finish_trait_type (CPTK_ADD_RVALUE_REFERENCE, type, NULL_TREE, tf_none); return get_reflection_raw (loc, type); } @@ -5251,8 +5251,8 @@ eval_remove_pointer (location_t loc, tree type) static tree eval_add_pointer (location_t loc, tree type) { - type = finish_trait_type (CPTK_ADD_POINTER, type, NULL_TREE, tf_none); type = strip_typedefs (type); + type = finish_trait_type (CPTK_ADD_POINTER, type, NULL_TREE, tf_none); return get_reflection_raw (loc, type); }