mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.49k stars 1.59k forks source link

Visual C++ language version #1973

Open Timmmm opened 7 years ago

Timmmm commented 7 years ago

As far as I can tell, cpp_std does nothing with MSVC. It's also not clear what it should do if you specify gnu... versions, e.g. gnu++11. I suggest it should treat those as if they were c++11, otherwise there's no way to get gnu++14 with GCC, and c++14 with MSVC.

These are the available options. As of now it is just /std:c++14 and /std:c++latest. Probably not worth supporting c++latest.

nirbheek commented 7 years ago

Yes, this is a known missing feature. We can do three things here which are reasonable:

  1. Maintain a mapping between VC++ version and the stds they support

  2. If the requested std is older than c++14, validate against the mapping and error out if the compiler version is too old. If it's new enough, no new args will be added.

  3. If the requested std is c++14 (or newer in the future) and the compiler version is new enough, add -std:c++14. If the compiler version is too old for the option but new enough for c++14, do nothing. If the compiler version is too old for c++14, error out.

However, it's not clear what the advantage is over just ignoring the cpp_std value right now. It looks like -std:c++14 doesn't actually do anything yet. It just reflects the current state of the compiler. In fact, it reflects the current state rather poorly. Even in VS 2017.

I think we should wait and see if Microsoft actually ever releases a C++ compiler that can be run in standards-compliant mode.

polarina commented 6 years ago

I implemented support for this in https://github.com/mesonbuild/meson/pull/2836