From: peter Date: Sun, 2 Dec 2018 00:47:57 +0000 (-0800) Subject: Fix CUDA 8 build on Windows (#14665) X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~2551 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35c8f93fd238d42aaea8fd6e730c3da9e18257cc;p=platform%2Fupstream%2Fpytorch.git Fix CUDA 8 build on Windows (#14665) Summary: Fixes #14663. Test for CUDA 8 is running here: https://dev.azure.com/pytorch/PyTorch/_build/results?buildId=54 Pull Request resolved: https://github.com/pytorch/pytorch/pull/14665 Differential Revision: D13290392 Pulled By: soumith fbshipit-source-id: 57f0d5b704e5d1fcb4927cbc007327b4ed74f443 --- diff --git a/c10/util/Optional.h b/c10/util/Optional.h index 87bb3de..9eb89a2 100644 --- a/c10/util/Optional.h +++ b/c10/util/Optional.h @@ -150,6 +150,13 @@ inline constexpr typename std::remove_reference::type&& constexpr_move( namespace detail_ { +// VS 2015 doesn't handle constexpr well, so we need to skip these stuff. +#if (defined _MSC_VER) && (_MSC_VER <= 1900) +template +T* static_addressof(T& ref) { + return std::addressof(ref); +} +#else // static_addressof: a constexpr version of addressof template struct has_overloaded_addressof { @@ -175,6 +182,7 @@ template )> T* static_addressof(T& ref) { return std::addressof(ref); } +#endif // the call to convert(b) has return type A and converts b to type A iff b // decltype(b) is implicitly convertible to A