summaryrefslogtreecommitdiff
path: root/binaries
diff options
context:
space:
mode:
authorArutyunovG <arutyunovg@yandex.ru>2019-01-05 08:23:02 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-01-05 08:29:31 -0800
commit2fb2d080d3e8c666341c536c45c8556d7f5b8ff4 (patch)
treeeb915db7d402c00d4c897b8cf80f86677c64bf2e /binaries
parenta918f1d9af8a0a405d84dff5fae64e269770bf49 (diff)
downloadpytorch-2fb2d080d3e8c666341c536c45c8556d7f5b8ff4.tar.gz
pytorch-2fb2d080d3e8c666341c536c45c8556d7f5b8ff4.tar.bz2
pytorch-2fb2d080d3e8c666341c536c45c8556d7f5b8ff4.zip
caffe2_benchmark msvc build fix (#15619)
Summary: Fixing error in caffe2_benchmark binary ``` 2018-12-29T14:09:59.7867995Z d:\a\1\s\caffe2_builders\v141\pytorch\binaries\benchmark_helper.h(90): error C2678: binary '|=': no operator found which takes a left-hand operand of type 'std::_Iosb<int>::_Openmode' (or there is no acceptable conversion) (compiling source file D:\a\1\s\caffe2_builders\v141\pytorch\binaries\benchmark_helper.cc) [D:\a\1\s\caffe2_builders\v141\pytorch\build\Release\binaries\caffe2_benchmark.vcxproj] 2018-12-29T14:09:59.7868252Z d:\a\1\s\caffe2_builders\v141\pytorch\binaries\benchmark_helper.h(92): error C2678: binary '|=': no operator found which takes a left-hand operand of type 'std::_Iosb<int>::_Openmode' (or there is no acceptable conversion) (compiling source file D:\a\1\s\caffe2_builders\v141\pytorch\binaries\benchmark_helper.cc) [D:\a\1\s\caffe2_builders\v141\pytorch\build\Release\binaries\caffe2_benchmark.vcxproj] ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/15619 Differential Revision: D13580195 Pulled By: soumith fbshipit-source-id: b0a4479cd5f7555801b1977aeee96b6433293da7
Diffstat (limited to 'binaries')
-rw-r--r--binaries/benchmark_helper.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/binaries/benchmark_helper.h b/binaries/benchmark_helper.h
index 0301440560..8c24a3d943 100644
--- a/binaries/benchmark_helper.h
+++ b/binaries/benchmark_helper.h
@@ -85,11 +85,12 @@ void writeTextOutput(
str.pop_back();
lines.push_back(str);
- auto flags = std::ios::out;
+ // static casts are workaround for MSVC build
+ auto flags = static_cast<std::ios_base::openmode>(std::ios::out);
if (index != 0) {
- flags |= std::ios::app;
+ flags |= static_cast<std::ios_base::openmode>(std::ios::app);
} else {
- flags |= std::ios::trunc;
+ flags |= static_cast<std::ios_base::openmode>(std::ios::trunc);
}
std::ofstream output_file(output_name, flags);
std::ostream_iterator<std::string> output_iterator(output_file, "\n");