-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[C++17][clang:Frontend] Clang can't deduce the correct deduction guide. #67959
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
Comments
The pull request #66487 Will solve the issue, once it is merged (It haven't been reviewed yet). |
@llvm/issue-subscribers-c-17
If there are two auto generated deduction guides from a templated and a non templated constructor we should choose the guide generated from the non-templated constructor. But clang can't deduce which one should we use. (gcc can)
|
@llvm/issue-subscribers-clang-frontend
If there are two auto generated deduction guides from a templated and a non templated constructor we should choose the guide generated from the non-templated constructor. But clang can't deduce which one should we use. (gcc can)
|
It is helpful to include reasonably sized code snippets so readers can understand the issue report in once place: template<class T>
struct A
{
A(T, T, int); //#1
template<class U>
A(int, T, U); //#2
};
A x(1, 2, 3); // Should choose #1
This looks like overload resolution to me from over.match.best.general p2.13. Looks like the wording came from p0620r0 which was about deduction guides but I don't see how the specific example is deduction guides but I may be missing something. |
You have to deduce the template parameter of A (to int) from the deduction guides generated from the constructors. The rule http://eel.is/c++draft/over.match.best.general#2.13 Says that the we have to use guide generated from the first constructor, but calng claims the deduction is ambigous. |
If there are two auto generated deduction guides from a templated and a non templated constructor we should choose the guide generated from the non-templated constructor. But clang can't deduce which one should we use. (gcc can)
https://godbolt.org/z/ee3e9qG78
The text was updated successfully, but these errors were encountered: