https://github.com/NewSigma updated 
https://github.com/llvm/llvm-project/pull/209107

>From 19c6bf4e7344aa51527066cc9c8840d82771e184 Mon Sep 17 00:00:00 2001
From: NewSigma <[email protected]>
Date: Mon, 13 Jul 2026 16:19:35 +0800
Subject: [PATCH] [clang][Sema] Fix rejected-valid for explicit object
 parameters in dependent nested classes context

---
 clang/docs/ReleaseNotes.md                 |  1 +
 clang/lib/Sema/SemaType.cpp                |  3 ++-
 clang/test/SemaCXX/cxx2b-deducing-this.cpp | 13 +++++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index a573599d76f7d..5cb523eb33e5a 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -789,6 +789,7 @@ latest release, please see the [Clang Web 
Site](https://clang.llvm.org) or the
 - Fixed assertion failures involving code completion with delayed default 
arguments and exception specifications. (#GH200879)
 - Fixed a regression where calling a function that takes a class-type 
parameter by value inside `decltype` of a concept could be incorrectly rejected 
when used as a non-type template argument. (#GH175831)
 - Fixed a crash in the constant evaluator when an ill-formed array 
new-expression whose bound could not be determined (e.g. `new int[]()`) was 
used in a constant expression. (#GH200139)
+- Fixed a rejected-valid case that used explicit object parameters in the 
context of dependent nested classes. (#GH136472)
 
 #### Bug Fixes to Compiler Builtins
 
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 1378c7baca92e..5d80a3a0c8cbe 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -4890,7 +4890,8 @@ static TypeSourceInfo 
*GetFullTypeForDeclarator(TypeProcessingState &state,
         // If there already was an problem with the scope, don’t issue another
         // error about the explicit object parameter.
         return SS.isInvalid() ||
-               isa_and_present<CXXRecordDecl>(S.computeDeclContext(SS));
+               isa_and_present<CXXRecordDecl>(
+                   S.computeDeclContext(SS, /*EnteringContext=*/true));
       };
 
       // C++23 [dcl.fct]p6:
diff --git a/clang/test/SemaCXX/cxx2b-deducing-this.cpp 
b/clang/test/SemaCXX/cxx2b-deducing-this.cpp
index b86731c7d7a11..539c8f8700fe7 100644
--- a/clang/test/SemaCXX/cxx2b-deducing-this.cpp
+++ b/clang/test/SemaCXX/cxx2b-deducing-this.cpp
@@ -1170,6 +1170,19 @@ struct S {
 };
 }
 
+namespace GH136472 {
+template<class T>
+struct S {
+  struct Nested {
+      void f(this auto);
+  };
+};
+
+// Test that out-of-line member defination of dependent nested class works
+template<class T>
+void S<T>::Nested::f(this auto) {}
+}
+
 namespace tpl_address {
 
 struct A {

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to