From 2fb2d080d3e8c666341c536c45c8556d7f5b8ff4 Mon Sep 17 00:00:00 2001 From: ArutyunovG Date: Sat, 5 Jan 2019 08:23:02 -0800 Subject: 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::_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::_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 --- binaries/benchmark_helper.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'binaries') 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::out); if (index != 0) { - flags |= std::ios::app; + flags |= static_cast(std::ios::app); } else { - flags |= std::ios::trunc; + flags |= static_cast(std::ios::trunc); } std::ofstream output_file(output_name, flags); std::ostream_iterator output_iterator(output_file, "\n"); -- cgit v1.2.3