Skip to content

Commit 5127dd3

Browse files
committed
cpp2util.h: Fix typeid(T) -> Typeid<T> usage with -fno-rtti.
1 parent 1269838 commit 5127dd3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/cpp2util.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,22 +433,22 @@ template<typename T>
433433
auto Typeid() -> decltype(auto) {
434434
#ifdef CPP2_NO_RTTI
435435
Type.expects(
436-
!"'any' dynamic casting is disabled with -fno-rtti", // more likely to appear on console
436+
!"'any' dynamic casting is disabled with -fno-rtti", // more likely to appear on console
437437
"'any' dynamic casting is disabled with -fno-rtti" // make message available to hooked handlers
438438
);
439439
#else
440440
return typeid(T);
441441
#endif
442442
}
443443

444-
// We don't need typeid(expr) yet -- uncomment this if/when we need it
444+
// We don't need typeid(expr) yet -- uncomment this if/when we need it
445445
//auto Typeid( [[maybe_unused]] auto&& x ) -> decltype(auto) {
446-
//#ifdef CPP2_DISABLE_RTTI
447-
// Type.expects(
448-
// !"<write appropriate error message here>"
449-
// );
446+
//#ifdef CPP2_NO_RTTI
447+
// Type.expects(
448+
// !"<write appropriate error message here>"
449+
// );
450450
//#else
451-
// return typeid(CPP2_FORWARD(x));
451+
// return typeid(CPP2_FORWARD(x));
452452
//#endif
453453
//}
454454

@@ -1144,7 +1144,7 @@ auto as( std::variant<Ts...> const& x ) -> decltype(auto) {
11441144
template<typename T, typename X>
11451145
requires (std::is_same_v<X,std::any> && !std::is_same_v<T,std::any> && !std::is_same_v<T,empty>)
11461146
constexpr auto is( X const& x ) -> bool
1147-
{ return x.type() == typeid(T); }
1147+
{ return x.type() == Typeid<T>(); }
11481148

11491149
template<typename T, typename X>
11501150
requires (std::is_same_v<X,std::any> && std::is_same_v<T,empty>)

0 commit comments

Comments
 (0)