Prevent VS from emitting ambiguous symbol errors (third time) (#53490)

Summary:
Fixes: https://github.com/pytorch/pytorch/issues/53409

First: https://github.com/pytorch/pytorch/issues/15697
Second: https://github.com/pytorch/pytorch/issues/17863

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53490

Reviewed By: VitalyFedyunin

Differential Revision: D26946687

Pulled By: mrshenli

fbshipit-source-id: 27f85abecbb75456354cc0373529c8cadc8133bd
This commit is contained in:
skyline75489
2021-03-11 13:47:24 -08:00
committed by Facebook GitHub Bot
parent 8016d28c0b
commit cdac61ecd4

View File

@ -275,21 +275,21 @@ decltype(auto) if_constexpr(ThenCallback&& thenCallback, ElseCallback&& elseCall
// This will give us better error messages.
if constexpr(Condition) {
if constexpr (detail::function_takes_identity_argument<ThenCallback>::value) {
return std::forward<ThenCallback>(thenCallback)(detail::_identity());
return ::std::forward<ThenCallback>(thenCallback)(detail::_identity());
} else {
return std::forward<ThenCallback>(thenCallback)();
return ::std::forward<ThenCallback>(thenCallback)();
}
} else {
if constexpr (detail::function_takes_identity_argument<ElseCallback>::value) {
return std::forward<ElseCallback>(elseCallback)(detail::_identity());
return ::std::forward<ElseCallback>(elseCallback)(detail::_identity());
} else {
return std::forward<ElseCallback>(elseCallback)();
return ::std::forward<ElseCallback>(elseCallback)();
}
}
#else
// C++14 implementation of if constexpr
return detail::_if_constexpr<Condition>::call(std::forward<ThenCallback>(thenCallback),
std::forward<ElseCallback>(elseCallback));
return detail::_if_constexpr<Condition>::call(::std::forward<ThenCallback>(thenCallback),
::std::forward<ElseCallback>(elseCallback));
#endif
}
@ -300,14 +300,14 @@ decltype(auto) if_constexpr(ThenCallback&& thenCallback) {
// This will give us better error messages.
if constexpr(Condition) {
if constexpr (detail::function_takes_identity_argument<ThenCallback>::value) {
return std::forward<ThenCallback>(thenCallback)(detail::_identity());
return ::std::forward<ThenCallback>(thenCallback)(detail::_identity());
} else {
return std::forward<ThenCallback>(thenCallback)();
return ::std::forward<ThenCallback>(thenCallback)();
}
}
#else
// C++14 implementation of if constexpr
return if_constexpr<Condition>(std::forward<ThenCallback>(thenCallback), [] (auto) {});
return if_constexpr<Condition>(::std::forward<ThenCallback>(thenCallback), [] (auto) {});
#endif
}