[clang] [Clang] Reapply CWG2369 "Ordering between constraints and substitution" (PR #122423)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 11 11:55:59 PST 2025


cor3ntin wrote:

I've confirmed with @zyn0217 that this iteration of the patch fixes the bug encountered by the chromium team wherein we tried to mangle lambdas with a deduced return type during constraint satisfaction - which caused failure on windows as mangling of lambda requires the enclosing context to be mangled. 

---

However if we merge this PR, the bug described in https://github.com/llvm/llvm-project/issues/121881 
would be reintroduced.

The issue is that users seem to rely on a GCC specific behavior where GCC does not check template candidates during overload resolution if an exact match exists. 
This is a known divergence that is known to both Clang and WG21 (see #62096)

Given that GCC's behavior is strictly non-conforming but long standing, I have asked CWG for guidance 
https://lists.isocpp.org/core/2025/01/16814.php

That being said, I think our option are
 
- Wait for WG21 to decide what to do and implement whatever resolution they come up with (which may or not be a breaking change for us)

- Follow GCC's behavior immediately, however there are some drawbacks as it seems like users which relies on it do so inadvertently (and some diagnostics would not be emitted)
 
- Only implement this DR under pedantic or c++26 mode to limit breakage

- Accept the breakage  

@zygoloid @hubert-reinterpretcast @erichkeane @AaronBallman 

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


More information about the cfe-commits mailing list