[PATCH] D131465: C++/ObjC++: switch to gnu++17 as the default standard

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 22 05:47:48 PDT 2022


aaron.ballman added subscribers: hans, majnemer, rnk.
aaron.ballman added a comment.

In D131465#3806709 <https://reviews.llvm.org/D131465#3806709>, @MaskRay wrote:

> In D131465#3804893 <https://reviews.llvm.org/D131465#3804893>, @glandium wrote:
>
>> This didn't change the default for msvc targets, was that expected?
>
> I think it is expected (but I did not know when I made the change)
>
> https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170 says the default is `/std:c++14`.
> If I use `/Zc:__cplusplus` on godbolt.org, I get `__cplusplus => 201402`. I think clang-cl likely wants to follow MSVC.
> The relevant code is around https://github.com/llvm/llvm-project/blob/669e508772e5e00db6285d699ee82a428dc00f32/clang/lib/Driver/ToolChains/Clang.cpp#L6628

I don't recall us sticking with the MSVC defaults the last time we bumped default language versions, but I've not gone back through email to look yet. Regardless, I don't think it's ergonomic for Clang to have a different default language standard for Windows targets -- that means when I run tests, they're all run in C++14 mode but when my coworker runs them, they're all C++17; we will assuredly run into "why does this test behave differently for you than me?" problems from diverging. Not everyone using clang is using clang-cl, so I think clang should default to the same language version for Windows as Linux. I think it's reasonable for clang-cl specifically to default to what MSVC does though. (CC @hans @majnemer @rnk to see if they recall details or have opinions.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131465/new/

https://reviews.llvm.org/D131465



More information about the cfe-commits mailing list