Skip to content

Commit eb55e3e

Browse files
committed
Added a workaround in tests for MSVC 14.1 in C++17 mode.
The compiler ICEs when tests for unallocated_resource helper are compiled. It isn't clear what upsets the compiler, but changing the unique_resource constructor that is being called works around the problem. Since unallocated_resource is still usable, we're not disabling it for this compiler and just update the test. Users encountering ICEs will have to deal with them on their end (upgrading the compiler might be one way to do it). https://developercommunity.visualstudio.com/t/ICE-when-compiling-NTTP-related-BoostSc/10922599
1 parent 74ddc67 commit eb55e3e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/run/unique_resource.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,14 @@ void check_simple_resource_traits()
15891589

15901590
g_n = 0;
15911591
{
1592+
#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1920)
15921593
boost::scope::unique_resource< int*, global_deleter_ptr, boost::scope::unallocated_resource< nullptr > > ur{ &g_n };
1594+
#else
1595+
// MSVC 14.1 fails with ICE on check_simple_resource_traits. It's not clear what exactly upsets the compiler,
1596+
// but fiddling with this constructor call seems to allow the compilation to succeed.
1597+
// https://developercommunity.visualstudio.com/t/ICE-when-compiling-NTTP-related-BoostSc/10922599
1598+
boost::scope::unique_resource< int*, global_deleter_ptr, boost::scope::unallocated_resource< nullptr > > ur{ &g_n, global_deleter_ptr() };
1599+
#endif
15931600
BOOST_TEST_EQ(ur.get(), &g_n);
15941601
BOOST_TEST(ur.allocated());
15951602
BOOST_TEST(!!ur);

0 commit comments

Comments
 (0)