Skip to content

Commit 7419c20

Browse files
authored
Workaround for unexpanded builtins in experimental/meta (llvm#64)
* workaround for unexpanded builtins in experimental/meta * Fix the rest of the builtin type traits (From TransformTypeTraits.def)
1 parent 7e30add commit 7419c20

File tree

1 file changed

+24
-15
lines changed
  • libcxx/include/experimental

1 file changed

+24
-15
lines changed

libcxx/include/experimental/meta

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ enum : unsigned {
442442
__metafn_return_type_of,
443443
};
444444

445+
consteval auto __workaround_expand_compiler_builtins(info type) -> info;
446+
445447
} // namespace detail
446448

447449
namespace __range_of_infos {
@@ -1582,15 +1584,15 @@ consteval auto type_is_nothrow_invocable_r(info type_result, info type,
15821584
}
15831585

15841586
consteval auto type_remove_const(info type) -> info {
1585-
return dealias(substitute(^remove_const_t, {type}));
1587+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_const_t, {type})));
15861588
}
15871589

15881590
consteval auto type_remove_volatile(info type) -> info {
1589-
return dealias(substitute(^remove_volatile_t, {type}));
1591+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_volatile_t, {type})));
15901592
}
15911593

15921594
consteval auto type_remove_cv(info type) -> info {
1593-
return dealias(substitute(^remove_cv_t, {type}));
1595+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_cv_t, {type})));
15941596
}
15951597

15961598
consteval auto type_add_const(info type) -> info {
@@ -1606,47 +1608,47 @@ consteval auto type_add_cv(info type) -> info {
16061608
}
16071609

16081610
consteval auto type_remove_reference(info type) -> info {
1609-
return dealias(substitute(^remove_reference_t, {type}));
1611+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_reference_t, {type})));
16101612
}
16111613

16121614
consteval auto type_add_lvalue_reference(info type) -> info {
1613-
return dealias(substitute(^add_lvalue_reference_t, {type}));
1615+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^add_lvalue_reference_t, {type})));
16141616
}
16151617

16161618
consteval auto type_add_rvalue_reference(info type) -> info {
1617-
return dealias(substitute(^add_rvalue_reference_t, {type}));
1619+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^add_rvalue_reference_t, {type})));
16181620
}
16191621

16201622
consteval auto type_make_signed(info type) -> info {
1621-
return dealias(substitute(^make_signed_t, {type}));
1623+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^make_signed_t, {type})));
16221624
}
16231625

16241626
consteval auto type_make_unsigned(info type) -> info {
1625-
return dealias(substitute(^make_unsigned_t, {type}));
1627+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^make_unsigned_t, {type})));
16261628
}
16271629

16281630
consteval auto type_remove_extent(info type) -> info {
1629-
return dealias(substitute(^remove_extent_t, {type}));
1631+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_extent_t, {type})));
16301632
}
16311633

16321634
consteval auto type_remove_all_extents(info type) -> info {
1633-
return dealias(substitute(^remove_all_extents_t, {type}));
1635+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_all_extents_t, {type})));
16341636
}
16351637

16361638
consteval auto type_remove_pointer(info type) -> info {
1637-
return dealias(substitute(^remove_pointer_t, {type}));
1639+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_pointer_t, {type})));
16381640
}
16391641

16401642
consteval auto type_add_pointer(info type) -> info {
1641-
return dealias(substitute(^add_pointer_t, {type}));
1643+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^add_pointer_t, {type})));
16421644
}
16431645

16441646
consteval auto type_remove_cvref(info type) -> info {
1645-
return dealias(substitute(^remove_cvref_t, {type}));
1647+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^remove_cvref_t, {type})));
16461648
}
16471649

16481650
consteval auto type_decay(info type) -> info {
1649-
return dealias(substitute(^decay_t, {type}));
1651+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^decay_t, {type})));
16501652
}
16511653

16521654
template <reflection_range R = initializer_list<info>>
@@ -1660,7 +1662,7 @@ consteval auto type_common_reference(R &&type_args) -> info {
16601662
}
16611663

16621664
consteval auto type_underlying_type(info type) -> info {
1663-
return dealias(substitute(^underlying_type_t, {type}));
1665+
return detail::__workaround_expand_compiler_builtins(dealias(substitute(^underlying_type_t, {type})));
16641666
}
16651667

16661668
template <reflection_range R = initializer_list<info>>
@@ -1743,6 +1745,13 @@ consteval auto accessible_subobjects_of(
17431745
return subobjects;
17441746
}
17451747

1748+
namespace detail {
1749+
template <class T> struct __wrap_workaround { using type = T; };
1750+
consteval auto __workaround_expand_compiler_builtins(info type) -> info {
1751+
return dealias(members_of(substitute(^__wrap_workaround, {type}))[0]);
1752+
}
1753+
1754+
} // namespace detail
17461755

17471756
#if __has_feature(parameter_reflection)
17481757

0 commit comments

Comments
 (0)