Skip to content

Commit 953035b

Browse files
bernhardmgrubermattkretz
authored andcommitted
disable span<T, dynamic_extent>::_as_bytes() for MSVC
1 parent 37d48ab commit 953035b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Vc/common/span.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@ template <typename T> class span<T, dynamic_extent>
518518
}
519519

520520
#ifdef __cpp_lib_byte
521+
// Disable _as_bytes() for MSVC as it leads to a compilation error due to a compiler bug.
522+
// When parsing the return type, MSVC will instantiate the primary template of span<> and static_assert().
523+
// A bugreport has been submitted and the issue is supposedly fixed in VS 16.10. If so, we can replace the #ifndef by:
524+
// #if _MSC_VER > 1928
525+
#ifndef _MSC_VER
521526
span<const std::byte, dynamic_extent> _as_bytes() const noexcept
522527
{
523528
return {reinterpret_cast<const std::byte*>(data()), size_bytes()};
@@ -527,6 +532,7 @@ template <typename T> class span<T, dynamic_extent>
527532
{
528533
return {reinterpret_cast<std::byte*>(data()), size_bytes()};
529534
}
535+
#endif
530536
#endif // __cpp_lib_byte
531537

532538
private:

0 commit comments

Comments
 (0)