Skip to content

Commit 4feb3b1

Browse files
mjbeardsleyMatt Beardsleyericniebler
authored
Remove ABI-incompatible assertion code in any_view.hpp (#1816)
* Remove ABI-incompatible assertion code in any_view.hpp If a provider of an any_view is built without NDEBUG defined, but a consumer is built with NDEBUG defined, the consumer will crash due to ABI-incompatibility in any_ref. Repros on clang with sanitizers, and that's an easily shareable demo: https://godbolt.org/z/Go9qxnjrM Can't get it to repro with a small example in gcc, even with sanitizers Repros in a small example on windows with msvc using same cpp/hpp files as above link - usually assertion failure in the assertion that this commit removes, sometimes Access Violation, but always crashes one way or another. No sanitizers needed to get a crash with msvc. It's just not easily shareable. --------- Co-authored-by: Matt Beardsley <[email protected]> Co-authored-by: Eric Niebler <[email protected]>
1 parent fcfe828 commit 4feb3b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/range/v3/view/any_view.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ namespace ranges
128128
#ifndef NDEBUG
129129
, info_(&typeid(rtti_tag<T>))
130130
#endif
131-
{}
131+
{
132+
(void)info_; // silence unused private member warning
133+
}
132134
template<typename T>
133135
T & get() const noexcept
134136
{
@@ -138,9 +140,7 @@ namespace ranges
138140

139141
private:
140142
void const volatile * obj_ = nullptr;
141-
#ifndef NDEBUG
142143
std::type_info const * info_ = nullptr;
143-
#endif
144144
};
145145

146146
template<typename Base>

0 commit comments

Comments
 (0)