From 006768903cb6586098218822129d622737848299 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Tue, 6 Nov 2018 20:40:18 +0100 Subject: Work around clang-cl breakage on make_unique/std::forward Clang on Windows with the MSVC ABI produces link errors of the form `unresolved std::_Iosb::{app,_Openmode} in ...`. Use a temporary variable to forward as lvalue rather than rvalue to work around the problem. --- Source/cmExportFileGenerator.cxx | 3 ++- Source/cmExportLibraryDependenciesCommand.cxx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index c8f743a..a12e0c4 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -70,8 +70,9 @@ bool cmExportFileGenerator::GenerateImportFile() std::unique_ptr foutPtr; if (this->AppendMode) { // Open for append. + auto openmodeApp = std::ios::app; foutPtr = cm::make_unique(this->MainImportFile.c_str(), - std::ios::app); + openmodeApp); } else { // Generate atomically and with copy-if-different. std::unique_ptr ap( diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index b4b2962..e542e50 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -50,8 +50,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const // Use copy-if-different if not appending. std::unique_ptr foutPtr; if (this->Append) { + const auto openmodeApp = std::ios::app; foutPtr = - cm::make_unique(this->Filename.c_str(), std::ios::app); + cm::make_unique(this->Filename.c_str(), openmodeApp); } else { std::unique_ptr ap( new cmGeneratedFileStream(this->Filename, true)); -- cgit v0.12