Skip to content

Commit 9f0b6c1

Browse files
committed
Added a workaround for broken name loopup in MSVC 14.1.
The compiler is performing incorrect name lookup in the context of a noexcept specifier of a friend function.
1 parent 5198001 commit 9f0b6c1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/boost/scope/unique_resource.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,7 @@ class unique_resource
15531553
*
15541554
* **Effects:** As if `left.swap(right)`.
15551555
*/
1556+
#if !defined(BOOST_MSVC) || (BOOST_MSVC < 1910 || BOOST_MSVC >= 1920)
15561557
#if !defined(BOOST_SCOPE_DOXYGEN)
15571558
template< bool Requires = detail::is_swappable< data >::value >
15581559
friend typename std::enable_if< Requires >::type
@@ -1564,6 +1565,14 @@ class unique_resource
15641565
{
15651566
left.swap(right);
15661567
}
1568+
#else // !defined(BOOST_MSVC) || (BOOST_MSVC < 1910 || BOOST_MSVC >= 1920)
1569+
// MSVC 14.1 has broken name lookup in the context of the noexcept specifier of a friend function
1570+
template< bool Requires = detail::is_swappable< data >::value, bool Noexcept = detail::is_nothrow_swappable< data >::value >
1571+
friend typename std::enable_if< Requires >::type swap(unique_resource& left, unique_resource& right) noexcept(Noexcept)
1572+
{
1573+
left.swap(right);
1574+
}
1575+
#endif // !defined(BOOST_MSVC) || (BOOST_MSVC < 1910 || BOOST_MSVC >= 1920)
15671576

15681577
//! \cond
15691578
private:

0 commit comments

Comments
 (0)