[clang] [C++20] [Modules] [Driver] Don't enable -fdelayed-template-parsing by default on windows with C++20 modules (PR #69431)

Markus Böck via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 13:57:38 PDT 2023


zero9178 wrote:

> > According to the docs [0], MSVC actually defaults to `-fno-delayed-template-parsing` (`/Zc:twoPhase-` with MSVC CLI) if using C++20. This is due to `-std:c++20` implying `/permissive-` which implies `/Zc:twoPhase-`. We could therefore just disable it based on language version alone, not just based on whether we are using modules.
> > I previously tried to make it the default everywhere in https://reviews.llvm.org/D103772. @rnk argued we could always make it the default. Given that MSVC is essentially phasing it out and making all their headers compatible with `/Zc:twoPhase-` for the sake of C++20 support, it should be more feasible than previously.
> > [0] https://learn.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-170
> 
> Thanks for the info! It looks like your patch can cover this patch. And we can be sure that this patch itself is correct.
> 
> Would you like to send that patch itself soon? If not, I'd like to land the patch soon to give better user experience. Then you can revert this. If you plan to send that patch soon, I'd like to discard the patch itself.

I sadly won't have the time to push this so feel free to proceed working on this PR.

> > > I still support disabling delayed template parsing by default in all configurations. Ultimately, this feature is a source of bugs, and we should start the clock on its deprecation and removal. This, of course, involves real work, and I haven't allocated any time (mine or others') to it.
> > 
> > 
> > So @ChuanqiXu9 's patch is at least a conservative step towards that (limiting the change to C++20 modules where we know there is a problem) - we could then extend that to C++20, in general (as per @zero9178 's comment above). As you say deprecation and removal is more work.
> 
> Yeah, how about we at least match MSVC here - and. generalize it to C++20 today, leaving the older deprecation work to others/another time?

I would also support this approach as it can also be seen as matching MSVC behaviour

https://github.com/llvm/llvm-project/pull/69431


More information about the cfe-commits mailing list