-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[16 regression] Partial specialization with constrained parameters declared in wrong order is suddenly "not more specialized" #58896
Comments
@llvm/issue-subscribers-clang-frontend |
Started looking into this one again. It is strange that if the parameters passed as the partial specialization are reversed, it 'works fine'. That is: |
I see the code in this area was extensively refactored/rewritten by @yuanfang-chen |
I note that the problem really is that we identify the args as 'equal' by doing profiling (SemaTemplateDeduction.cpp:5544), BUT because of the reversing, 1 canonical is "depth = 0, index = 1" and the other is "depth = 0, Index = 0". Which is why reversing them works. @yuanfang-chen : Is this something you can take a look at? |
Sure. I'll take a look. |
Note @yuanfang-chen : I'm on the fence as to whether this is related to: #60749. I am beginning to lean again to this having a similar cause. |
Actually, the partial specialization without constraint C works as Clang 15(https://godbolt.org/z/esYcKf971):
The only difference in Clang 16 is how constraint C is used in partial ordering. For the original test case, partial ordering bail out at https://eel.is/c++draft/temp.func.order#6.2.2 (specifically |
Perhaps I'm being a little dense here... but are you saying Clang16 is 'correct' here and that this example should be rejected? |
Sorry, I wasn't clear. Yes, I meant Clang16 is correct. |
@hubert-reinterpretcast : I think I agree with Yuanfang's reading here after spending a bit of this morning on it. Can you confirm, and we can close this as 'not a defect'? |
@yuanfang-chen : If you wouldn't mind, a commit explaining this and adding a test (if one doesn't already exist!) to make sure we're enforcing this would be greatly appreciated. |
Sure. Then I found llvm-project/clang/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p6.cpp Lines 92 to 93 in c9447c6
|
That test works, but would still like a comment on that one with the ref to temp.func.order next to it. |
How about
|
SGTM! Would appreciate that! |
No problem. Sent 3e00f24 |
I think I'm convinced, so unless Hubert says otherwise (and reopens this), I'm just going to close it. |
Clang 15 accepts this, but trunk says:
Desugaring this to
template <typename B, typename A> requires C<A, B>
has no effect, the error is still there.But further fixing the parameter order to
template <typename A, typename B> requires C<A, B>
fixes the error.Tested at trunk commit
129177eaf0ecb202a6f44ab8d23ad51fe00d15f6
with-std=c++20
.The text was updated successfully, but these errors were encountered: