Skip to content

[SUGGESTION] Start using import std; in cpp2util.h with MSVC and re-enable -import-std in CI builds #950

@bluetarpmedia

Description

@bluetarpmedia

Now that MSVC (with /std:c++latest) supports import std; it's possible to remove the Microsoft-only experimental import std.core; etc lines from cpp2util.h and replace them with import std; or import std.compat;.

As described in #943, the import std.core; code was not working in the GitHub-hosted CI runner, so the MSVC regression tests have been updated to run cppfront with -include-std to #include headers instead of importing any modules.

I experimented with import std; and GitHub-hosted runners and documented two methods to get them building correctly:

  • running msbuild for a Visual Studio solution
  • using cl.exe in a shell, which is applicable for cppfront's GitHub CI workflow

https://github.com/bluetarpmedia/msvc-import-std-github

So this suggestion involves 2 changes:

  1. Update cpp2util.h to use import std; (where available)
  2. Update the GitHub CI workflow to restore the default -import-std behaviour, and modify the MSVC build job to compile import std; modules support first before then compiling the tests (more info in my msvc-import-std-github repo)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions