================ @@ -0,0 +1,143 @@ +// RUN: rm -rf %t ---------------- hahnjo wrote:
Yes, I totally see that this snippet gets us into the code path. However, it's completely besides the point because the `ConversionFunction`s are already canonical. In fact, there are only two tests in the repository where one of these two asserts triggers: ```diff diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 6e02a965e64b..d010e3c77f44 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -4405,11 +4405,15 @@ CompareImplicitConversionSequences(Sema &S, SourceLocation Loc, ICS1.Standard, ICS2.Standard); else if (ICS1.isUserDefined()) { const FunctionDecl *ConvFunc1 = ICS1.UserDefined.ConversionFunction; - if (ConvFunc1) + if (ConvFunc1) { + assert(ConvFunc1 == ConvFunc1->getCanonicalDecl()); ConvFunc1 = ConvFunc1->getCanonicalDecl(); + } const FunctionDecl *ConvFunc2 = ICS2.UserDefined.ConversionFunction; - if (ConvFunc2) + if (ConvFunc2) { + assert(ConvFunc2 == ConvFunc2->getCanonicalDecl()); ConvFunc2 = ConvFunc2->getCanonicalDecl(); + } // User-defined conversion sequence U1 is a better conversion // sequence than another user-defined conversion sequence U2 if // they contain the same user-defined conversion function or ``` That's `PCH/cxx-ms-function-specialization-class-scope.cpp` and `SemaTemplate/ms-function-specialization-class-scope.cpp`. However, we need an even stronger situation where `ConvFunc1 != ConvFunc2`, *but* they point to the same canonical decl, which is not met by the two tests. The only way I was able to see this happen is with a `templated` conversion operator and one of its instantiations in a lazily loaded module, with the fixes of https://github.com/llvm/llvm-project/pull/133057 applied. Look, if this problem was easy to trigger, a) somebody would have already found and fixed it years ago, and b) it would not have taken us that much time to find this reproducer in the context of https://github.com/llvm/llvm-project/pull/133057. https://github.com/llvm/llvm-project/pull/154158 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits