On 12/6/23 02:33, waffl3x wrote:
Here is the next version, it feels very close to finished. As before, I
haven't ran a bootstrap or the full testsuite yet but I did run the
explicit-obj tests which completed as expected.

There's a few test cases that still need to be written but more tests
can always be added. The behavior added by CWG2789 works in at least
one case, but I have not added tests for it yet. The test cases for
dependent lambda expressions need to be fleshed out more, but a few
temporary ones are included to demonstrate that they do work and that
the crash is fixed. Explicit object conversion functions work, but I
need to add fleshed out tests for them, explicit-obj-basic5.C has that
test.

@@ -6586,6 +6586,17 @@ add_candidates (tree fns, tree first_arg, const vec<tree, 
va_gc> *args,
+           /* FIXME: I believe this will be bugged for xobj member functions,
+              leaving this comment here to make sure we look into it
+              at some point.
+              Seeing this makes me want correspondence checking to be unified
+              in one place though, not sure if this one needs to be different
+              from other ones though.
+              This function is only used here, but maybe we can use it in add
+              method and move some of the logic out of there?

fns_correspond absolutely needs updating to handle xob fns, and doing that by unifying it with add_method's calculation would be good.

+              Side note: CWG2586 might be relevant for this area in
+              particular, perhaps we wait to see if it gets accepted first?  */

2586 was accepted last year.

@@ -12574,17 +12601,25 @@ cand_parms_match (z_candidate *c1, z_candidate *c2)
       fn1 = DECL_TEMPLATE_RESULT (t1);
       fn2 = DECL_TEMPLATE_RESULT (t2);
     }
+  /* The changes I made here might be stuff I was told not to worry about?
+     I'm not really sure so I'm going to leave it in.  */

Good choice, this comment can go.

   tree parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn1));
   tree parms2 = TYPE_ARG_TYPES (TREE_TYPE (fn2));
   if (DECL_FUNCTION_MEMBER_P (fn1)
       && DECL_FUNCTION_MEMBER_P (fn2)
-      && (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn1)
-         != DECL_NONSTATIC_MEMBER_FUNCTION_P (fn2)))
+      && (DECL_STATIC_FUNCTION_P (fn1)
+         != DECL_STATIC_FUNCTION_P (fn2)))
     {
       /* Ignore 'this' when comparing the parameters of a static member
         function with those of a non-static one.  */
-      parms1 = skip_artificial_parms_for (fn1, parms1);
-      parms2 = skip_artificial_parms_for (fn2, parms2);
+      auto skip_parms = [](tree fn, tree parms){
+         if (DECL_XOBJ_MEMBER_FUNCTION_P (fn))
+           return TREE_CHAIN (parms);
+         else
+           return skip_artificial_parms_for (fn, parms);
+       };
+      parms1 = skip_parms (fn1, parms1);
+      parms2 = skip_parms (fn2, parms2);
     }

https://cplusplus.github.io/CWG/issues/2789.html fixes the handling of xobj fns here.

Your change does the right thing for comparing static and xobj, but doesn't handle comparing iobj and xobj; I think we want to share parameter comparison code with fns_correspond/add_method. Maybe parms_correspond?

@@ -8727,21 +8882,42 @@ resolve_address_of_overloaded_function (tree 
target_type,
   /* Good, exactly one match.  Now, convert it to the correct type.  */
   fn = TREE_PURPOSE (matches);
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
-      && !(complain & tf_ptrmem_ok) && !flag_ms_extensions)
+  if (DECL_OBJECT_MEMBER_FUNCTION_P (fn)
+      && !(complain & tf_ptrmem_ok))
     {
-      static int explained;
-
-      if (!(complain & tf_error))
+      /* For iobj member functions, if if -fms_extensions was passed in, this
+        is not an error, so we do nothing.  It is still an error regardless
+        for xobj member functions though, as it is a new feature we
+        (hopefully) don't need to support the behavior.  */

Unfortunately, it seems that MSVC extended their weirdness to xobj fns, so -fms-extensions should as well.
https://godbolt.org/z/nfvn64Kx5

+                 /* I'm keeping it more basic for now.  */

OK, this comment can go.

@@ -15502,9 +15627,10 @@ void
 grok_special_member_properties (tree decl)
 {
   tree class_type;
-
+  /* I believe we have to make some changes in here depending on the outcome
+     of CWG2586.  */

As mentioned above, CWG2586 is resolved. Be sure to scroll down to the approved resolution, or refer to the working draft.
https://cplusplus.github.io/CWG/issues/2586.html

@@ -11754,8 +11754,16 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tre
   else if (cxx_dialect < cxx23)
     omitted_parms_loc = cp_lexer_peek_token (parser->lexer)->location;
+ /* Review note: I figured I might as well update the comments since I'm here.
+     There are also some additions to the below.  */

Great, this comment can go.

+      /* [expr.prim.lambda.general-4]
+        If the lambda-declarator contains an explicit object parameter
+        ([dcl.fct]), then no lambda-specifier in the lambda-specifier-seq
+        shall be mutable or static.  */
+      if (lambda_specs.storage_class == sc_mutable)
+       {
+         auto_diagnostic_group d;
+         error_at (lambda_specs.locations[ds_storage_class],
+                   "%<mutable%> lambda specifier "
+                   "with explicit object parameter");
+         /* Tell the user how to do what they probably meant, maybe fixits
+            would be apropriate later?  */

"appropriate"

+         if (!dependent_type_p (non_reference (param_type)))
+           /* If we are given a non-dependent type we will have already given
+              a diagnosis that the following would contradict with.  */;

Only if the lambda has captures, though?

We could also change dependent_type_p to the more specific WILDCARD_TYPE_P, I think, both here and just above.

+         else if (!TYPE_REF_P (param_type))
+           inform (DECL_SOURCE_LOCATION (xobj_param),
+                   "the passed in closure object will not be mutated because "
+                   "it is taken by copy/move");

"by value"

@@ -3092,7 +3093,31 @@ finish_this_expr (void)
     return rvalue (result);
tree fn = current_nonlambda_function ();
-  if (fn && DECL_STATIC_FUNCTION_P (fn))
+  if (fn && DECL_XOBJ_MEMBER_FUNCTION_P (fn))
+    {
+      auto_diagnostic_group d;
+      error ("%<this%> is unavailable for explicit object member "
+            "functions");
+      /* Doing a fixit here is possible, but hard, might be worthwhile
+        in the future.  */
+      tree xobj_parm = DECL_ARGUMENTS (fn);
+      gcc_assert (xobj_parm);
+      tree parm_name = DECL_NAME (xobj_parm);
+      if (parm_name)
+       inform (DECL_SOURCE_LOCATION (xobj_parm),
+               "use explicit object parameter %qD instead",
+               parm_name);
+      else
+       {
+         gcc_rich_location xobj_loc (DECL_SOURCE_LOCATION (xobj_parm));
+         /* This doesn't work and I don't know why.  I'll probably remove it
+            before the final version.  */
+         xobj_loc.add_fixit_insert_after (" self");
+         inform (DECL_SOURCE_LOCATION (xobj_parm),
+                 "name and use the explicit object parameter instead");

Now seems to be the time to either fix or remove it.

@@ -12811,9 +12836,11 @@ capture_decltype (tree decl)
       if (WILDCARD_TYPE_P (non_reference (obtype)))
        /* We don't know what the eventual obtype quals will be.  */
        return NULL_TREE;
-      int quals = cp_type_quals (type);
-      if (INDIRECT_TYPE_P (obtype))
-       quals |= cp_type_quals (TREE_TYPE (obtype));
+      /* This change possibly conflicts with another patch that is currently
+        in flight. (Patrick Palka's PR83167 patch) I am just changing it for
+        now to satisfy my tests.  */
+      int const quals = cp_type_quals (type)
+                     | cp_type_quals (TREE_TYPE (obtype));

Doesn't TREE_TYPE (obtype) break for by-value xob? In that case I think we'd want cp_type_quals (obtype).

+   The name "nonstatic" is no longer accurate with the addition of
+   xobj member functions, should we change the name?  */
bool
 invalid_nonstatic_memfn_p (location_t loc, tree expr, tsubst_flags_t complain)

This rule still applies to all non-static member functions:
https://eel.is/c++draft/expr.ref#6.3.2

@@ -2352,7 +2355,7 @@ invalid_nonstatic_memfn_p (location_t loc, tree expr, 
tsubst_flags_t complain)
   if (is_overloaded_fn (expr) && !really_overloaded_fn (expr))
     expr = get_first_fn (expr);
   if (TREE_TYPE (expr)
-      && DECL_NONSTATIC_MEMBER_FUNCTION_P (expr))
+      && DECL_IOBJ_MEMBER_FUNCTION_P (expr))

...and so I think this should be _OBJECT_.
https://godbolt.org/z/r6v4e1ePP

Here's a patch to adjust all the remaining DECL_NONSTATIC_MEMBER_FUNCTION_P. With this patch -diagnostic7.C gets the old address of non-static diagnostic, I think correctly, so I'm not sure we still need the BASELINK change in cp_build_addr_expr_1?

Jason
From 6322ee6863f0385f1adec1e59672000e6133184b Mon Sep 17 00:00:00 2001
From: Jason Merrill <ja...@redhat.com>
Date: Wed, 6 Dec 2023 21:30:18 -0500
Subject: [PATCH] c++: avoid DECL_NONSTATIC_MEMBER_FUNCTION_P
To: gcc-patches@gcc.gnu.org

Explicit object member functions are also non-static member functions, so we
need to change uses of DECL_NONSTATIC_MEMBER_FUNCTION_P to clarify whether
they intend to include or exclude them.

gcc/cp/ChangeLog:

	* cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): Poison.
	(DECL_CONST_MEMFUNC_P)
	(DECL_VOLATILE_MEMFUNC_P)
	(DECL_NONSTATIC_MEMBER_P)
	* call.cc (maybe_warn_class_memaccess)
	(joust)
	(do_warn_dangling_reference): Don't use it.
	* class.cc (finalize_literal_type_property)
	(finish_struct)
	* constexpr.cc (is_valid_constexpr_fn)
	* contracts.cc (build_contract_condition_function)
	* cp-objcp-common.cc (cp_decl_dwarf_attribute)
	* cxx-pretty-print.cc (cxx_pretty_printer::postfix_expression)
	(cxx_pretty_printer::declaration_specifiers)
	(cxx_pretty_printer::direct_declarator)
	* decl.cc (cp_finish_decl)
	(record_key_method_defined)
	* decl2.cc (cp_handle_deprecated_or_unavailable)
	* init.cc (find_uninit_fields_r)
	(build_offset_ref)
	* lambda.cc (nonlambda_method_basetype)
	* method.cc (early_check_defaulted_comparison)
	(num_artificial_parms_for)
	* pt.cc (is_specialization_of_friend)
	(determine_specialization)
	(copy_default_args_to_explicit_spec)
	(check_explicit_specialization)
	(tsubst_contract_attribute)
	(check_non_deducible_conversions)
	(maybe_instantiate_noexcept)
	(register_parameter_specializations)
	(value_dependent_expression_p)
	* search.cc (shared_member_p)
	(lookup_member)
	(field_access_p)
	* semantics.cc (finish_omp_declare_simd_methods)
	* tree.cc (lvalue_kind): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.

libcc1/ChangeLog:

	* libcp1plugin.cc (plugin_pragma_push_user_expression): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.
---
 gcc/cp/cp-tree.h           | 16 +++++++++-------
 gcc/cp/call.cc             | 11 ++++++-----
 gcc/cp/class.cc            |  4 ++--
 gcc/cp/constexpr.cc        |  2 +-
 gcc/cp/contracts.cc        |  6 +++---
 gcc/cp/cp-objcp-common.cc  |  4 ++--
 gcc/cp/cxx-pretty-print.cc |  6 +++---
 gcc/cp/decl.cc             |  4 ++--
 gcc/cp/decl2.cc            |  2 +-
 gcc/cp/init.cc             |  4 ++--
 gcc/cp/lambda.cc           |  2 +-
 gcc/cp/method.cc           |  6 +++---
 gcc/cp/pt.cc               | 24 ++++++++++++------------
 gcc/cp/search.cc           |  5 +++--
 gcc/cp/semantics.cc        |  2 +-
 gcc/cp/tree.cc             |  2 +-
 libcc1/libcp1plugin.cc     |  2 +-
 17 files changed, 53 insertions(+), 49 deletions(-)

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index e222742092f..111cb7f6a0e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3348,10 +3348,12 @@ struct GTY(()) lang_decl {
 #define DECL_STATIC_FUNCTION_P(NODE) \
   (LANG_DECL_FN_CHECK (NODE)->static_function)
 
-/* Nonzero for FUNCTION_DECL means that this decl is a non-static
-   member function, use DECL_IOBJ_MEMBER_FUNCTION_P instead.  */
-#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
-  (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
+/* Nonzero for FUNCTION_DECL means that this decl is a non-static member
+   function.  C++23 explicit object member functions are also considered
+   non-static, but most former uses of this macro meant implicit object member
+   function.  Instead of this macro, use DECL_IOBJ_MEMBER_FUNCTION_P or
+   DECL_OBJECT_MEMBER_FUNCTION_P.  */
+#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) did_you_mean_object_or_iobj
 
 /* Nonzero for FUNCTION_DECL means that this decl is an implicit object
    member function.  */
@@ -3381,20 +3383,20 @@ struct GTY(()) lang_decl {
 /* Nonzero for FUNCTION_DECL means that this member function
    has `this' as const X *const.  */
 #define DECL_CONST_MEMFUNC_P(NODE)					 \
-  (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)				 \
+  (DECL_IOBJ_MEMBER_FUNCTION_P (NODE)				 \
    && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE				 \
 				  (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
 
 /* Nonzero for FUNCTION_DECL means that this member function
    has `this' as volatile X *const.  */
 #define DECL_VOLATILE_MEMFUNC_P(NODE)					 \
-  (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)				 \
+  (DECL_IOBJ_MEMBER_FUNCTION_P (NODE)				 \
    && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE				 \
 				  (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
 
 /* Nonzero for a DECL means that this member is a non-static member.  */
 #define DECL_NONSTATIC_MEMBER_P(NODE)		\
-  (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)	\
+  (DECL_OBJECT_MEMBER_FUNCTION_P (NODE)	\
    || TREE_CODE (NODE) == FIELD_DECL)
 
 /* Nonzero for a FIELD_DECL means that this member object type
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index c64d420f073..3d9b575a89b 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -10705,7 +10705,8 @@ maybe_warn_class_memaccess (location_t loc, tree fndecl,
      type.  If so, and if the class has no non-trivial bases or members,
      be more permissive.  */
   if (current_function_decl
-      && DECL_NONSTATIC_MEMBER_FUNCTION_P (current_function_decl)
+      && DECL_OBJECT_MEMBER_FUNCTION_P (current_function_decl)
+      /* ??? is_object_parameter?  */
       && is_this_parameter (tree_strip_nop_conversions (dest)))
     {
       tree ctx = DECL_CONTEXT (current_function_decl);
@@ -12799,7 +12800,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
 			  print_z_candidate (input_location,
 					     N_("candidate 2:"), l);
 			  if (w->fn == l->fn
-			      && DECL_NONSTATIC_MEMBER_FUNCTION_P (w->fn)
+			      && DECL_IOBJ_MEMBER_FUNCTION_P (w->fn)
 			      && (type_memfn_quals (TREE_TYPE (w->fn))
 				  & TYPE_QUAL_CONST) == 0)
 			    {
@@ -13929,7 +13930,7 @@ do_warn_dangling_reference (tree expr, bool arg_p)
 	       because R refers to one of the int elements of V, not to
 	       a temporary object.  Member operator* may return a reference
 	       but probably not to one of its arguments.  */
-	    || (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
+	    || (DECL_OBJECT_MEMBER_FUNCTION_P (fndecl)
 		&& DECL_OVERLOADED_OPERATOR_P (fndecl)
 		&& DECL_OVERLOADED_OPERATOR_IS (fndecl, INDIRECT_REF)))
 	  return NULL_TREE;
@@ -13955,7 +13956,7 @@ do_warn_dangling_reference (tree expr, bool arg_p)
 	    tree arg = CALL_EXPR_ARG (expr, i);
 	    /* Check that this argument initializes a reference, except for
 	       the argument initializing the object of a member function.  */
-	    if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
+	    if (!DECL_IOBJ_MEMBER_FUNCTION_P (fndecl)
 		&& !TYPE_REF_P (TREE_TYPE (arg)))
 	      continue;
 	    STRIP_NOPS (arg);
@@ -13975,7 +13976,7 @@ do_warn_dangling_reference (tree expr, bool arg_p)
 	       const S& s = S().self();
 	     where 's' dangles.  If we've gotten here, the object this function
 	     is invoked on is not a temporary.  */
-	    if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl))
+	    if (DECL_OBJECT_MEMBER_FUNCTION_P (fndecl))
 	      break;
 	  }
 	return NULL_TREE;
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index d7a4ad5ad51..99c33380c2d 100644
--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
@@ -6123,7 +6123,7 @@ finalize_literal_type_property (tree t)
     for (fn = TYPE_FIELDS (t); fn; fn = DECL_CHAIN (fn))
       if (TREE_CODE (fn) == FUNCTION_DECL
 	  && DECL_DECLARED_CONSTEXPR_P (fn)
-	  && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+	  && DECL_IOBJ_MEMBER_FUNCTION_P (fn)
 	  && !DECL_CONSTRUCTOR_P (fn))
 	{
 	  DECL_DECLARED_CONSTEXPR_P (fn) = false;
@@ -8087,7 +8087,7 @@ finish_struct (tree t, tree attributes)
   if (flag_openmp)
     for (tree decl = TYPE_FIELDS (t); decl; decl = DECL_CHAIN (decl))
       if (TREE_CODE (decl) == FUNCTION_DECL
-	  && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+	  && DECL_OBJECT_MEMBER_FUNCTION_P (decl))
 	if (tree attr = lookup_attribute ("omp declare variant base",
 					  DECL_ATTRIBUTES (decl)))
 	  omp_declare_variant_finalize (decl, attr);
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 58187a4fd12..4da6f1a0524 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -291,7 +291,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 
       /* C++14 DR 1684 removed this restriction.  */
       if (cxx_dialect < cxx14
-	  && DECL_NONSTATIC_MEMBER_FUNCTION_P (fun)
+	  && DECL_IOBJ_MEMBER_FUNCTION_P (fun)
 	  && !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun)))
 	{
 	  ret = false;
diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index 035ca4827e7..c505b67d339 100644
--- a/gcc/cp/contracts.cc
+++ b/gcc/cp/contracts.cc
@@ -1398,7 +1398,7 @@ build_contract_condition_function (tree fndecl, bool pre)
 {
   if (TREE_TYPE (fndecl) == error_mark_node)
     return error_mark_node;
-  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
+  if (DECL_IOBJ_MEMBER_FUNCTION_P (fndecl)
       && !TYPE_METHOD_BASETYPE (TREE_TYPE (fndecl)))
     return error_mark_node;
 
@@ -1421,7 +1421,7 @@ build_contract_condition_function (tree fndecl, bool pre)
       arg_type && arg_type != void_list_node;
       arg_type = TREE_CHAIN (arg_type))
     {
-      if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
+      if (DECL_IOBJ_MEMBER_FUNCTION_P (fndecl)
 	  && TYPE_ARG_TYPES (TREE_TYPE (fn)) == arg_type)
       {
 	class_type = TREE_TYPE (TREE_VALUE (arg_type));
@@ -1451,7 +1451,7 @@ build_contract_condition_function (tree fndecl, bool pre)
     }
 
   TREE_TYPE (fn) = build_function_type (value_type, arg_types);
-  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl))
+  if (DECL_IOBJ_MEMBER_FUNCTION_P (fndecl))
     TREE_TYPE (fn) = build_method_type (class_type, TREE_TYPE (fn));
 
   DECL_NAME (fn) = copy_node (DECL_NAME (fn));
diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc
index 9439c4dc744..f3ba8179329 100644
--- a/gcc/cp/cp-objcp-common.cc
+++ b/gcc/cp/cp-objcp-common.cc
@@ -349,7 +349,7 @@ cp_decl_dwarf_attribute (const_tree decl, int attr)
 
     case DW_AT_reference:
       if (TREE_CODE (decl) == FUNCTION_DECL
-	  && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
+	  && DECL_IOBJ_MEMBER_FUNCTION_P (decl)
 	  && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
 	  && !FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
 	return 1;
@@ -357,7 +357,7 @@ cp_decl_dwarf_attribute (const_tree decl, int attr)
 
     case DW_AT_rvalue_reference:
       if (TREE_CODE (decl) == FUNCTION_DECL
-	  && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
+	  && DECL_IOBJ_MEMBER_FUNCTION_P (decl)
 	  && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl))
 	  && FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl)))
 	return 1;
diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc
index 6a82358f370..53c0722d2f3 100644
--- a/gcc/cp/cxx-pretty-print.cc
+++ b/gcc/cp/cxx-pretty-print.cc
@@ -553,7 +553,7 @@ cxx_pretty_printer::postfix_expression (tree t)
 	   instantiation time.  */
 	if (TREE_CODE (fun) != FUNCTION_DECL)
 	  ;
-	else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun))
+	else if (DECL_OBJECT_MEMBER_FUNCTION_P (fun))
 	  {
 	    tree object = (code == AGGR_INIT_EXPR
 			   ? (AGGR_INIT_VIA_CTOR_P (t)
@@ -1342,7 +1342,7 @@ cxx_pretty_printer::declaration_specifiers (tree t)
 	 do not have a type-specifier in their return types.  */
       if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t))
 	function_specifier (t);
-      else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
+      else if (DECL_IOBJ_MEMBER_FUNCTION_P (t))
 	declaration_specifiers (TREE_TYPE (TREE_TYPE (t)));
       else
         c_pretty_printer::declaration_specifiers (t);
@@ -1700,7 +1700,7 @@ cxx_pretty_printer::direct_declarator (tree t)
       expression (t);
       pp_cxx_parameter_declaration_clause (this, t);
 
-      if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
+      if (DECL_IOBJ_MEMBER_FUNCTION_P (t))
 	{
 	  padding = pp_before;
 	  pp_cxx_cv_qualifier_seq (this, pp_cxx_implicit_parameter_type (t));
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index e51ede5d043..e5d19ab9162 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -8524,7 +8524,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
       && TREE_CODE (decl) == FUNCTION_DECL
       /* #pragma omp declare variant on methods handled in finish_struct
 	 instead.  */
-      && (!DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
+      && (!DECL_OBJECT_MEMBER_FUNCTION_P (decl)
 	  || COMPLETE_TYPE_P (DECL_CONTEXT (decl))))
     if (tree attr = lookup_attribute ("omp declare variant base",
 				      DECL_ATTRIBUTES (decl)))
@@ -18288,7 +18288,7 @@ outer_curly_brace_block (tree fndecl)
 static void
 record_key_method_defined (tree fndecl)
 {
-  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
+  if (DECL_OBJECT_MEMBER_FUNCTION_P (fndecl)
       && DECL_VIRTUAL_P (fndecl)
       && !processing_template_decl)
     {
diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index bee84879023..59c41d8e583 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -5625,7 +5625,7 @@ cp_handle_deprecated_or_unavailable (tree decl, tsubst_flags_t complain)
   if (cxx_dialect >= cxx11
       && DECL_P (decl)
       && DECL_ARTIFICIAL (decl)
-      && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
+      && DECL_IOBJ_MEMBER_FUNCTION_P (decl)
       && copy_fn_p (decl))
     {
       /* Don't warn if the flag was disabled around the class definition
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index 6444f0a8518..fb5f404805b 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -866,7 +866,7 @@ find_uninit_fields_r (tree *tp, int *walk_subtrees, void *data)
   else if (code == CALL_EXPR)
     {
       tree fn = get_callee_fndecl (init);
-      if (fn && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+      if (fn && DECL_IOBJ_MEMBER_FUNCTION_P (fn))
 	{
 	  tree op = CALL_EXPR_ARG (init, 0);
 	  if (TREE_CODE (op) == ADDR_EXPR)
@@ -2477,7 +2477,7 @@ build_offset_ref (tree type, tree member, bool address_p,
 
 	   -- in a mem-initializer for a constructor for that class or for
 	   a class derived from that class (_class.base.init_).  */
-      if (DECL_NONSTATIC_MEMBER_FUNCTION_P (member))
+      if (DECL_OBJECT_MEMBER_FUNCTION_P (member))
 	{
 	  /* Build a representation of the qualified name suitable
 	     for use as the operand to "&" -- even though the "&" is
diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc
index 8baf82578c7..ee48b2170d2 100644
--- a/gcc/cp/lambda.cc
+++ b/gcc/cp/lambda.cc
@@ -1015,7 +1015,7 @@ nonlambda_method_basetype (void)
 
       tree fn = TYPE_CONTEXT (type);
       if (!fn || TREE_CODE (fn) != FUNCTION_DECL
-	  || !DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+	  || !DECL_IOBJ_MEMBER_FUNCTION_P (fn))
 	/* No enclosing non-lambda method.  */
 	return NULL_TREE;
       if (!LAMBDA_FUNCTION_P (fn))
diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc
index ca3102a57a5..8302ae2370d 100644
--- a/gcc/cp/method.cc
+++ b/gcc/cp/method.cc
@@ -1187,7 +1187,7 @@ early_check_defaulted_comparison (tree fn)
 	ok = false;
     }
 
-  bool mem = DECL_NONSTATIC_MEMBER_FUNCTION_P (fn);
+  bool mem = DECL_IOBJ_MEMBER_FUNCTION_P (fn);
   if (mem && type_memfn_quals (TREE_TYPE (fn)) != TYPE_QUAL_CONST)
     {
       error_at (loc, "defaulted %qD must be %<const%>", fn);
@@ -1230,7 +1230,7 @@ early_check_defaulted_comparison (tree fn)
 
   if (saw_bad || (saw_byval && saw_byref))
     {
-      if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+      if (DECL_IOBJ_MEMBER_FUNCTION_P (fn))
 	error_at (loc, "defaulted member %qD must have parameter type "
 		  "%<const %T&%>", fn, ctx);
       else if (saw_bad)
@@ -3627,7 +3627,7 @@ num_artificial_parms_for (const_tree fn)
 {
   int count = 0;
 
-  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+  if (DECL_IOBJ_MEMBER_FUNCTION_P (fn))
     count++;
   else
     return 0;
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 4a677d5910b..76b5640beac 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -1443,9 +1443,9 @@ is_specialization_of_friend (tree decl, tree friend_decl)
 	     `this' parameter.  */
 	  friend_args_type = TYPE_ARG_TYPES (friend_type);
 	  decl_args_type = TYPE_ARG_TYPES (decl_type);
-	  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (friend_decl))
+	  if (DECL_IOBJ_MEMBER_FUNCTION_P (friend_decl))
 	    friend_args_type = TREE_CHAIN (friend_args_type);
-	  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+	  if (DECL_IOBJ_MEMBER_FUNCTION_P (decl))
 	    decl_args_type = TREE_CHAIN (decl_args_type);
 
 	  return compparms (decl_args_type, friend_args_type);
@@ -2222,7 +2222,7 @@ determine_specialization (tree template_id,
 	     that the const qualification is the same.  Since
 	     get_bindings does not try to merge the "this" parameter,
 	     we must do the comparison explicitly.  */
-	  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+	  if (DECL_IOBJ_MEMBER_FUNCTION_P (fn))
 	    {
 	      if (!same_type_p (TREE_VALUE (fn_arg_types),
 				TREE_VALUE (decl_arg_types)))
@@ -2345,14 +2345,14 @@ determine_specialization (tree template_id,
 	  /* Adjust the type of DECL in case FN is a static member.  */
 	  decl_arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl));
 	  if (DECL_STATIC_FUNCTION_P (fn)
-	      && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+	      && DECL_IOBJ_MEMBER_FUNCTION_P (decl))
 	    decl_arg_types = TREE_CHAIN (decl_arg_types);
 
 	  if (!compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
 			 decl_arg_types))
             continue;
 
-	  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+	  if (DECL_IOBJ_MEMBER_FUNCTION_P (fn)
 	      && (type_memfn_rqual (TREE_TYPE (decl))
 		  != type_memfn_rqual (TREE_TYPE (fn))))
 	    continue;
@@ -2538,7 +2538,7 @@ copy_default_args_to_explicit_spec (tree decl)
   old_type = TREE_TYPE (decl);
   spec_types = TYPE_ARG_TYPES (old_type);
 
-  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+  if (DECL_IOBJ_MEMBER_FUNCTION_P (decl))
     {
       /* Remove the this pointer, but remember the object's type for
 	 CV quals.  */
@@ -3123,7 +3123,7 @@ check_explicit_specialization (tree declarator,
 	     make DECL a static member function as well.  */
 	  if (DECL_FUNCTION_TEMPLATE_P (tmpl)
 	      && DECL_STATIC_FUNCTION_P (tmpl)
-	      && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+	      && DECL_IOBJ_MEMBER_FUNCTION_P (decl))
 	    revert_static_member_fn (decl);
 
 	  /* If this is a specialization of a member template of a
@@ -11743,7 +11743,7 @@ tsubst_contract_attribute (tree decl, tree t, tree args,
   /* For member functions, make this available for semantic analysis.  */
   tree save_ccp = current_class_ptr;
   tree save_ccr = current_class_ref;
-  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+  if (DECL_IOBJ_MEMBER_FUNCTION_P (decl))
     {
       tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl));
       tree this_type = TREE_TYPE (TREE_VALUE (arg_types));
@@ -22054,7 +22054,7 @@ check_non_deducible_conversions (tree parms, const tree *args, unsigned nargs,
 {
   /* Non-constructor methods need to leave a conversion for 'this', which
      isn't included in nargs here.  */
-  unsigned offset = (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+  unsigned offset = (DECL_IOBJ_MEMBER_FUNCTION_P (fn)
 		     && !DECL_CONSTRUCTOR_P (fn));
 
   for (unsigned ia = 0;
@@ -26633,7 +26633,7 @@ maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain)
 	  push_deferring_access_checks (dk_no_deferred);
 	  input_location = DECL_SOURCE_LOCATION (fn);
 
-	  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+	  if (DECL_IOBJ_MEMBER_FUNCTION_P (fn)
 	      && !DECL_LOCAL_DECL_P (fn))
 	    {
 	      /* If needed, set current_class_ptr for the benefit of
@@ -26696,7 +26696,7 @@ register_parameter_specializations (tree pattern, tree inst)
 {
   tree tmpl_parm = DECL_ARGUMENTS (pattern);
   tree spec_parm = DECL_ARGUMENTS (inst);
-  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (inst))
+  if (DECL_IOBJ_MEMBER_FUNCTION_P (inst))
     {
       register_local_specialization (spec_parm, tmpl_parm);
       spec_parm = skip_artificial_parms_for (inst, spec_parm);
@@ -28043,7 +28043,7 @@ value_dependent_expression_p (tree expression)
 	       cause the call to be considered value-dependent.  We also
 	       look through it in potential_constant_expression.  */
 	    if (i == 0 && fn && DECL_DECLARED_CONSTEXPR_P (fn)
-		&& DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+		&& DECL_IOBJ_MEMBER_FUNCTION_P (fn)
 		&& TREE_CODE (op) == ADDR_EXPR)
 	      op = TREE_OPERAND (op, 0);
 	    if (value_dependent_expression_p (op))
diff --git a/gcc/cp/search.cc b/gcc/cp/search.cc
index efea5078992..a22202fe6f3 100644
--- a/gcc/cp/search.cc
+++ b/gcc/cp/search.cc
@@ -1010,7 +1010,7 @@ shared_member_p (tree t)
 	    /* Conservatively assume a dependent using-declaration
 	       might resolve to a non-static member.  */
 	    return false;
-	  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+	  if (DECL_OBJECT_MEMBER_FUNCTION_P (decl))
 	    return false;
 	}
       return true;
@@ -1266,7 +1266,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type,
       decl = strip_using_decl (decl);
       /* A dependent USING_DECL will be checked after tsubsting.  */
       if (TREE_CODE (decl) != USING_DECL
-	  && !DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
+	  && !DECL_IOBJ_MEMBER_FUNCTION_P (decl)
 	  && !perform_or_defer_access_check (basetype_path, decl, decl,
 					     complain, afi))
 	return error_mark_node;
@@ -1739,6 +1739,7 @@ field_access_p (tree component_ref, tree field_decl, tree field_type)
     return false;
 
   tree ptr = STRIP_NOPS (TREE_OPERAND (indirect_ref, 0));
+  /* ??? is_object_parameter?  */
   if (!is_this_parameter (ptr))
     return false;
 
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index c47f57e889d..21831792ec5 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -6704,7 +6704,7 @@ finish_omp_declare_simd_methods (tree t)
   for (tree x = TYPE_FIELDS (t); x; x = DECL_CHAIN (x))
     {
       if (TREE_CODE (x) == USING_DECL
-	  || !DECL_NONSTATIC_MEMBER_FUNCTION_P (x))
+	  || !DECL_IOBJ_MEMBER_FUNCTION_P (x))
 	continue;
       tree ods = lookup_attribute ("omp declare simd", DECL_ATTRIBUTES (x));
       if (!ods || !TREE_VALUE (ods))
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index 79b6fa05c06..4635cbbba5b 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -298,7 +298,7 @@ lvalue_kind (const_tree ref)
     case FUNCTION_DECL:
       /* All functions (except non-static-member functions) are
 	 lvalues.  */
-      return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref)
+      return (DECL_IOBJ_MEMBER_FUNCTION_P (ref)
 	      ? clk_none : clk_ordinary);
 
     case BASELINK:
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 3c8e9e8b436..108d5786167 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -468,7 +468,7 @@ plugin_pragma_push_user_expression (cpp_reader *)
 	}
     }
 
-  if (unchanged_cfun || DECL_NONSTATIC_MEMBER_FUNCTION_P (changed_func_decl))
+  if (unchanged_cfun || DECL_OBJECT_MEMBER_FUNCTION_P (changed_func_decl))
     {
       /* Check whether the oracle supplies us with a "this", and if
 	 so, arrange for data members and this itself to be
-- 
2.39.3

Reply via email to