[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 29 06:33:03 PDT 2022


aaron.ballman added a comment.

In D131465#3823599 <https://reviews.llvm.org/D131465#3823599>, @hans wrote:

> In D131465#3821701 <https://reviews.llvm.org/D131465#3821701>, @aaron.ballman wrote:
>
>> Perhaps the simple rule we're going for is "when executed on Windows, Clang defaults to C++17 unless it is executed from a context in which an MSVC library can be detected, in which case Clang defaults to the same language standard as used by that version of MSVC"? It's a bit long-winded, but the idea being that we try to match MSVC's default when compiling against MSVC libraries and otherwise stick with the clang default.
>
> But the last sentence is basically what we have today. When targeting windows-msvc, we try to match the behavior of the msvc version being targeted, which is in turn determined by what flags the user passes, what msvc installation is found in the environment, or the default (19.14).

Hmmm, you're right. I think I may have confused myself with the behaviors here -- MSVC still reports `__cplusplus` as `199711L` but they seem to accept a random smattering of C++17 by default and mostly accept C++14, at least from some simple testing: https://godbolt.org/z/dxjq5Wocx

So it's a bit hard to say what kind of compatibility we're aiming for there...


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