[caffe2][a10] Move down pragma pop to properly suppress warning 4522 (#49233)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49233
As the comments on line 160, say we should suppress this overly aggressive warning with MSVC:
```
caffe2\tensorbody.h_ovrsource#header-mode-symlink-tree-only,headers\aten\core\tensorbody.h(1223): warning C4522: 'at::Tensor': multiple assignment operators specified
```
However, in order to remove the warning, the closing brace of the class must be between the`#pragma warning` push and its corresponding pop. Move the pop down to ensure that.
Test Plan: Built locally using clang for Windows without buck cache, confirmed the warning resolved
Reviewed By: bhosmer
Differential Revision: D25422447
fbshipit-source-id: c1e1c66fb8513af5f9d4e3c1dc48d0070c4a1f84
diff --git a/aten/src/ATen/templates/TensorBody.h b/aten/src/ATen/templates/TensorBody.h
index 1c0a04a..0dfef70 100644
--- a/aten/src/ATen/templates/TensorBody.h
+++ b/aten/src/ATen/templates/TensorBody.h
@@ -208,10 +208,6 @@
Tensor& operator=(const Tensor&) &&;
Tensor& operator=(Tensor&&) &&;
- #ifdef _MSC_VER
- #pragma warning( pop )
- #endif
-
bool is_same(const Tensor& other) const noexcept {
return impl_ == other.impl_;
}
@@ -761,6 +757,12 @@
c10::intrusive_ptr<TensorImpl, UndefinedTensorImpl> impl_;
};
+// For "multiple ... operators specified" warnings, closing brace of class
+// declaration must be included between pragma push & pop
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+
int64_t get_device(Tensor self);
template <typename T>