-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[concepts] CTAD does not propagate constructor constraints to deduction guides #57646
Comments
@llvm/issue-subscribers-clang-frontend |
I tried to understand what the standard says here, and AFAICT the overload resolution in the CTAD here happens in terms of implicitly generated deduction guides which don't propagate the trailing requires from the constructors (see [over.match.class.deduct]). So I think this is technically ambiguous. Relevant GCC discussion from last year: https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg257689.html Wish they'd file a CWG issue for this. |
Great, this is also a duplicate of almost 3-years old #43829. |
This is now CWG2528. I don't see a reason not to implement the suggested fix, since GCC/MSVC already do it. |
Implement suggested fix for [[ https://cplusplus.github.io/CWG/issues/2628.html | DR2628. ]] Couldn't update the DR docs because there hasn't been a DR index since it was filed, but the tests still run in CI. Note: I only transfer the constructor constraints, not the struct constraints. I think that's OK because the struct constraints are the same for all constructors so they don't affect the overload resolution, and if they deduce to something that doesn't pass the constraints we catch it anyway. So (hopefully) that should be more efficient without sacrificing correctness. Closes: llvm/llvm-project#57646 llvm/llvm-project#43829 Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D134145
[Clang] Implement fix for DR2628 Implement suggested fix for [[ https://cplusplus.github.io/CWG/issues/2628.html | DR2628. ]] Couldn't update the DR docs because there hasn't been a DR index since it was filed, but the tests still run in CI. Note: I only transfer the constructor constraints, not the struct constraints. I think that's OK because the struct constraints are the same for all constructors so they don't affect the overload resolution, and if they deduce to something that doesn't pass the constraints we catch it anyway. So (hopefully) that should be more efficient without sacrificing correctness. Closes: llvm#57646 llvm#43829 Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D134145
Sample:
https://godbolt.org/z/coxs3PvbE
This fails with:
The same code passes with GCC 12.
The text was updated successfully, but these errors were encountered: