[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-02 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > This still doesn't handle cases such as: > > ```c++ > template > concept E = sizeof(T) == sizeof(U) && sizeof(V) == sizeof(W); > > template // T = char > struct A > { > template // U = signed char > struct B > { > template // V = int, W = int, X = > short >

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-02 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: This still doesn't handle cases such as: ```cpp template concept E = sizeof(T) == sizeof(U) && sizeof(V) == sizeof(W); template // T = char struct A { template // U = signed char struct B { template // V = int, W = int, X = short requires E //

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-02 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > I agree with @sdkrystian, even though the test crashes for maybe yet another > reason, it demonstrates you can friend a function from a different template > context, so comparing the depths from different branches is not helpful. @mizvekov I missed the case which friend

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-02 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky updated https://github.com/llvm/llvm-project/pull/90646 >From 50aa5b64f6d2cf98706bfb4792f274bd071e3b9c Mon Sep 17 00:00:00 2001 From: Qizhi Hu <836744...@qq.com> Date: Wed, 1 May 2024 02:25:04 +0800 Subject: [PATCH 1/2] [Clang][Sema] fix a bug on constraint check with

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: FWIW, the changes in be79079507ffbd9b29683498f405dc2c32dd8ba7 fix the crash https://github.com/llvm/llvm-project/pull/90646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-01 Thread Matheus Izvekov via cfe-commits
mizvekov wrote: I agree with @sdkrystian, even though the test crashes for maybe yet another reason, it demonstrates you can friend a function from a different template context, so comparing the depths from different branches is not helpful. https://github.com/llvm/llvm-project/pull/90646

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-01 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > ```c++ > template > concept D = sizeof(T) == sizeof(U); > > template > struct A > { > template requires D > static void f(); > }; > > template > struct B > { > template > struct C > { > friend void A::f(); > }; > }; > > template struct B::C; >

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-01 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: ```cpp template concept D = sizeof(T) == sizeof(U); template struct A { template requires D static void f(); }; template struct B { template struct C { friend void A::f(); }; }; template struct B::C; extern template void A::f(); // crash here

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: This seems reasonable, @mizvekov is doing more work in this area, so I'd like him to make sure this isn't something he's fixed elsewhere. https://github.com/llvm/llvm-project/pull/90646 ___ cfe-commits mailing

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-05-01 Thread Qizhi Hu via cfe-commits
jcsxky wrote: Windows CI failed with some unrelated files. https://github.com/llvm/llvm-project/pull/90646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-04-30 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > I'm actually working on constraint checking for function template > specializations in #88963. I don't think this patch is quite right... this > will cause a crash if the befriended function is a member of a class template > specialization. Relative to the changes in #88963, I

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-04-30 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: I'm actually working on constraint checking for function template specializations in #88963. I don't think this patch is quite right... this will cause a crash if the befriended function is a member of a class template specialization. Relative to the changes in #88963, I

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-04-30 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Qizhi Hu (jcsxky) Changes attempt to fix https://github.com/llvm/llvm-project/issues/90349 Skip to add outer class template arguments to `MTAL` when the friend function has the same depth with its lexical context(`CXXRecordDecl`). ---

[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

2024-04-30 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/90646 attempt to fix https://github.com/llvm/llvm-project/issues/90349 Skip to add outer class template arguments to `MTAL` when the friend function has the same depth with its lexical context(`CXXRecordDecl`). >From