llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Younan Zhang (zyn0217) <details> <summary>Changes</summary> Reverts llvm/llvm-project#<!-- -->233482 It broke some valid code as reported in https://github.com/llvm/llvm-project/pull/233482#issuecomment-6556714067 --- Full diff: https://github.com/llvm/llvm-project/pull/237716.diff 4 Files Affected: - (modified) clang/docs/ReleaseNotes.md (-3) - (modified) clang/lib/Sema/SemaInit.cpp (+3-4) - (modified) clang/test/SemaCXX/conversion-function.cpp (-13) - (modified) clang/test/SemaCXX/cxx1y-generic-lambdas.cpp (+1-3) ``````````diff diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index a2ad6d06815c7c..d2df8fe262fbff 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -897,9 +897,6 @@ documentation](CIR/index.md) for more information regarding ClangIR's status and `sized_by_or_null` describe the size in bytes rather than a count of elements, they are now correctly accepted on such pointers. -- Fixed rejecting valid reference initialization with conversion function templates whose returned type is depending on - template parameters. (#GH226984) - - Fixed a crash when an `address_space` attribute with a dependent argument was written after the declarator-id, where it appertains to the declared entity rather than to a declarator chunk. (#GH196982, #GH111463) diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index d9134c052fa9df..2e3c6309fec20e 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -5384,13 +5384,12 @@ static OverloadingResult TryRefInitWithConversionFunction( // If the conversion function doesn't return a reference type, // it can't be considered for this conversion unless we're allowed to - // consider rvalues. If it's a template, we should accept it first - // and specialize it before deciding whether to reject it. + // consider rvalues. // FIXME: Do we need to make sure that we only consider conversion // candidates with reference-compatible results? That might be needed to // break recursion. - if (ConvTemplate || AllowRValues || - Conv->getConversionType()->isLValueReferenceType()) { + if ((AllowRValues || + Conv->getConversionType()->isLValueReferenceType())) { if (ConvTemplate) S.AddTemplateConversionCandidate( ConvTemplate, I.getPair(), ActingDC, Initializer, DestType, diff --git a/clang/test/SemaCXX/conversion-function.cpp b/clang/test/SemaCXX/conversion-function.cpp index 629c818b89c004..1a09a527b750cc 100644 --- a/clang/test/SemaCXX/conversion-function.cpp +++ b/clang/test/SemaCXX/conversion-function.cpp @@ -557,16 +557,3 @@ namespace GH189146 { int s = S{}(0); // expected-error {{attempt to use a deleted function}} } #endif - -#if __cplusplus >= 201402L -namespace GH226984 { - struct A { - int& ref; - - template<int dependent = 0> - operator decltype(dependent, ref)(); -}; - int x = 0; - int& y = A(x); -} -#endif diff --git a/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp b/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp index bb621666319046..3066bb0d0f0cc3 100644 --- a/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp +++ b/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp @@ -214,9 +214,7 @@ namespace conversion_operator { void test() { auto L = [](auto a) -> int { return a; }; // expected-error {{cannot initialize}} int (*fp)(int) = L; - int (&fp2)(int) = [](auto a) { return a; }; - // expected-error@-1 {{no viable conversion}} - // expected-note-re@-2 {{candidate template ignored: could not match 'auto (*)(auto){{.*}}' against 'int (int)'}} + int (&fp2)(int) = [](auto a) { return a; }; // expected-error{{non-const lvalue}} int (&&fp3)(int) = [](auto a) { return a; }; // expected-error@-1 {{no viable conversion}} // expected-note-re@-2 {{candidate template ignored: could not match 'auto (*)(auto){{.*}}' against 'int (int)'}} `````````` </details> https://github.com/llvm/llvm-project/pull/237716 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
