@@ -3580,6 +3580,22 @@ typeref entries representing typedefs or type operators.
35803580
35813581#if !STANDALONE_UTILITY_PROGRAM
35823582
3583+ static a_type_ptr add_pointer_to_type(a_type_ptr tp)
3584+ /*
3585+ Apply the transformation corresponding to std::add_pointer_t to tp and return
3586+ the resulting type.
3587+ */
3588+ {
3589+ if (is_referenceable_type(tp) || is_void_type(tp)) {
3590+ if (is_reference_type(tp)) {
3591+ tp = type_pointed_to(tp);
3592+ } /* if */
3593+ tp = make_pointer_type(tp);
3594+ } /* if */
3595+ return tp;
3596+ } /* add_pointer_to_type */
3597+
3598+
35833599a_type_ptr apply_type_transforming_intrinsic(
35843600 a_type_ptr tp,
35853601 a_typeref_kind kind,
@@ -3641,10 +3657,7 @@ diagnostic in error cases. error_pos is the position to use for diagnostics
36413657 result = remove_qualifiers(tp, TQ_VOLATILE);
36423658 break;
36433659 case trk_add_pointer:
3644- if (is_reference_type(tp)) {
3645- tp = type_pointed_to(tp);
3646- } /* if */
3647- result = make_pointer_type(tp);
3660+ result = add_pointer_to_type(tp);
36483661 break;
36493662 case trk_remove_pointer:
36503663 if (is_pointer_type(tp)) {
@@ -3824,7 +3837,7 @@ Return TRUE if the given type is a referenceable type [defns.referenceable].
38243837{
38253838 tp = skip_typerefs(tp);
38263839 return is_object_type(tp) || is_reference_ptr(tp) ||
3827- (is_function(tp) && !is_qualified_type (tp));
3840+ (is_function(tp) && !is_qualified_function_type (tp));
38283841} /* is_referenceable_type */
38293842
38303843
@@ -4080,7 +4093,7 @@ Apply the transformation corresponding to std::decay_t.
40804093 if (is_array_type(tp)) {
40814094 tp = make_pointer_type(array_element_type(tp));
40824095 } else if (is_function_type(tp)) {
4083- tp = make_pointer_type (tp);
4096+ tp = add_pointer_to_type (tp);
40844097 } else {
40854098 tp = remove_qualifiers(tp, TQ_CONST | TQ_VOLATILE | TQ_RESTRICT);
40864099 } /* if */
0 commit comments