diff options
author | Brad King <brad.king@kitware.com> | 2019-02-12 13:28:56 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-12 13:31:00 (GMT) |
commit | 9d2ab63aaf5fb29d812dbfc942da4d7671c5d1b3 (patch) | |
tree | 448336b84b0ea7c415be60b0281168a293c3eaf8 /Source | |
parent | 20afd497c92f66883de5dae92e2105c2f0cb4f70 (diff) | |
parent | 091afa7342e6c093f404b4777b81313535d73435 (diff) | |
download | CMake-9d2ab63aaf5fb29d812dbfc942da4d7671c5d1b3.zip CMake-9d2ab63aaf5fb29d812dbfc942da4d7671c5d1b3.tar.gz CMake-9d2ab63aaf5fb29d812dbfc942da4d7671c5d1b3.tar.bz2 |
Merge topic 'clangcl-fixes'
091afa7342 Tests: Teach tests when to treat clang-cl as MSVC
006768903c Work around clang-cl breakage on make_unique/std::forward
d625dfcdf9 Avoid compiling CMake itself as C++17 with Clang's MSVC ABI
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2573
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Checks/cm_cxx17_check.cpp | 13 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmExportLibraryDependenciesCommand.cxx | 3 |
3 files changed, 17 insertions, 2 deletions
diff --git a/Source/Checks/cm_cxx17_check.cpp b/Source/Checks/cm_cxx17_check.cpp index 4e89184..2de10d6 100644 --- a/Source/Checks/cm_cxx17_check.cpp +++ b/Source/Checks/cm_cxx17_check.cpp @@ -2,8 +2,21 @@ #include <memory> #include <unordered_map> +#ifdef _MSC_VER +# include <comdef.h> +#endif + int main() { std::unique_ptr<int> u(new int(0)); + +#ifdef _MSC_VER + // clang-cl has problems instantiating this constructor in C++17 mode + // error: indirection requires pointer operand ('const _GUID' invalid) + // return *_IID; + IUnknownPtr ptr{}; + IDispatchPtr disp(ptr); +#endif + return *u; } 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<cmsys::ofstream> foutPtr; if (this->AppendMode) { // Open for append. + auto openmodeApp = std::ios::app; foutPtr = cm::make_unique<cmsys::ofstream>(this->MainImportFile.c_str(), - std::ios::app); + openmodeApp); } else { // Generate atomically and with copy-if-different. std::unique_ptr<cmGeneratedFileStream> 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<cmsys::ofstream> foutPtr; if (this->Append) { + const auto openmodeApp = std::ios::app; foutPtr = - cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), std::ios::app); + cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), openmodeApp); } else { std::unique_ptr<cmGeneratedFileStream> ap( new cmGeneratedFileStream(this->Filename, true)); |