[gcc r17-3507] c++: improve SFINAE in lookup_destructor

Jason Merrill via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:5dc5d050b35b35233b92217c8ebf9dd3abf0bf50

commit r17-3507-g5dc5d050b35b35233b92217c8ebf9dd3abf0bf50
Author: Jason Merrill <[email protected]>
Date:   Thu Aug 20 14:14:38 2026 -0400

    c++: improve SFINAE in lookup_destructor
    
    This doesn't fix anything currently, but while working on another change I
    noticed that we weren't passing complain down here.
    
    gcc/cp/ChangeLog:
    
            * typeck.cc (lookup_destructor): Pass complain to lookup_member.

Diff:
---
 gcc/cp/typeck.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 5bde051b9b36..712b95ab245c 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -3251,7 +3251,9 @@ lookup_destructor (tree object, tree scope, tree dtor_name,
     }
   expr = lookup_member (dtor_type, complete_dtor_identifier,
 			/*protect=*/1, /*want_type=*/false,
-			tf_warning_or_error);
+			complain);
+  if (expr == error_mark_node)
+    return error_mark_node;
   if (!expr)
     {
       if (complain & tf_error)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.