microsoft / microsoft/WindowsAppSDK
Proposal: Support compiling projects with Clang
@mikebattista is already working on this.
Since Aug 18, 2021.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
# Proposal: Support compiling projects with Clang
## Summary
A while ago, support for compiling C++ desktop apps with Clang was added to Visual Studio (see [here](https://devblogs.microsoft.com/cppblog/clang-llvm-support-in-visual-studio/), [here](https://devblogs.microsoft.com/cppblog/clang-llvm-support-for-msbuild-projects/) and [here](https://docs.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-160)). However, projects created using the Project Reunion Visual Studio Extension do not offer to use Clang as the project's platform toolset. Clang support should be extended for such projects.
## Rationale
Project Reunion apps that are written in C++ must use C++/WinRT which means that the C++ code is standards conformant and hence _theoretically_ compilable with any modern C++ compiler. Technically, the compiler _shouldn't_ matter because the code will only run on Windows. _But_ we have a C++ cross-platform codebase that targets Android, iOS and Windows and we do run into compatibility issues between Clang and Visual C++.
Code that compiles fine for Android and iOS with Clang fails to compile with Visual C++ for Windows. An example is a large `constexpr` array that compiles with Clang but not with Visual C++. We have opened a [bug](https://developercommunity.visualstudio.com/t/Fatal-Error-C1060-when-compiling-large-c/476290) describing this issue more than two years ago but is still not fixed yet. Another example where the compiler matters is in its supported string size. The Visual C++ compiler emits compiler error [C2026](https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=msvc-160&viewFallbackFrom=vs-2017) if it deems a string to be too long. Clang uses a different, larger limit for strings and the [bug](https://developercommunity.visualstudio.com/t/Remove-the-C2026-string-too-big-limitati/379411#T-ND384309) I opened regarding this is even older but still not fixed.
There are more examples where C++ compilers are incompatible although they target the same language standard and platform. It is not my intention to put any blame on the Visual C++ compiler team. They simply have more important things to do than fixing those edge case issues. But I want to point out that there are good reasons to compile a codebase with the same compiler everywhere. Although it shouldn't matter it actually does.
Therefore, please consider adding the option to compile projects created using the Project Reunion Visual Studio Extension with Clang.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.