fix the test for buggy MSVC 2017

This commit is contained in:
Laurent Rineau 2024-04-30 10:18:45 +02:00
parent 15349f0bda
commit 0095302f2d
1 changed files with 10 additions and 1 deletions

View File

@ -14,8 +14,17 @@ struct A // move-only class, move-constructible from B
int main() int main()
{ {
// this test requires C++17 mandatory return-value optimization (RVO) #if ! defined(_MSC_VER) || (_MSC_VER > 1916)
// This test requires C++17 mandatory return-value optimization (RVO).
//
// MSVC-2017 does not implement C++17 correctly
// See https://godbolt.org/z/7Y34Y1c53
// and commit 15349f0bdafe60b85697f9d142c2652200d968e8
// where we introduced a workaround for MSVC-2017: disable the correct
// forwarding of arguments in the `make_array` function.
// For that reason we disable this test for MSVC-2017)
std::array<A, 1> a = CGAL::make_array<A>(B()); std::array<A, 1> a = CGAL::make_array<A>(B());
#endif
auto b = CGAL::make_array<double>(1u); auto b = CGAL::make_array<double>(1u);
static_assert(std::is_same_v<decltype(b), std::array<double, 1>>); static_assert(std::is_same_v<decltype(b), std::array<double, 1>>);
CGAL_USE(a); CGAL_USE(a);