@@ -286,6 +286,7 @@ class ClassStateData(typing.NamedTuple):
286286
287287 # have to defer processing these
288288 defer_protected_methods : typing .List [Method ]
289+ defer_private_nonvirtual_methods : typing .List [Method ]
289290 defer_private_virtual_methods : typing .List [Method ]
290291 defer_protected_fields : typing .List [Field ]
291292
@@ -750,6 +751,7 @@ def on_class_start(self, state: AWClassBlockState) -> typing.Optional[bool]:
750751 typealias_names = typealias_names ,
751752 # Method data
752753 defer_protected_methods = [],
754+ defer_private_nonvirtual_methods = [],
753755 defer_private_virtual_methods = [],
754756 defer_protected_fields = [],
755757 # Trampoline data
@@ -983,8 +985,11 @@ def on_class_method(self, state: AWClassBlockState, method: Method) -> None:
983985 self ._on_class_method (state , method , cctx .wrapped_public_methods )
984986 elif access == "protected" :
985987 cdata .defer_protected_methods .append (method )
986- elif access == "private" and is_polymorphic :
987- cdata .defer_private_virtual_methods .append (method )
988+ elif access == "private" :
989+ if is_polymorphic :
990+ cdata .defer_private_virtual_methods .append (method )
991+ else :
992+ cdata .defer_private_nonvirtual_methods .append (method )
988993
989994 def _on_class_method (
990995 self ,
@@ -1152,6 +1157,23 @@ def _on_class_method(
11521157 f"{ cdata .cls_key } ::{ method_name } : has && ref-qualifier which cannot be directly bound by pybind11, must specify cpp_code or ignore_py"
11531158 )
11541159
1160+ def _on_class_method_process_overload_only (
1161+ self , state : AWClassBlockState , method : Method
1162+ ):
1163+ cdata = state .user_data
1164+
1165+ method_name = self ._get_fn_name (method )
1166+ if not method_name :
1167+ return
1168+
1169+ self .gendata .get_function_data (
1170+ method_name ,
1171+ method ,
1172+ cdata .cls_key ,
1173+ cdata .data ,
1174+ True ,
1175+ )
1176+
11551177 def _is_copy_move_constructor (
11561178 self , cctx : ClassContext , first_type_param : DecoratedType
11571179 ) -> bool :
@@ -1242,6 +1264,17 @@ def on_class_end(self, state: AWClassBlockState) -> None:
12421264 f"{ cdata .cls_key } has trampoline_inline_code specified, but there is no trampoline!"
12431265 )
12441266
1267+ else :
1268+ # still need to do minimal processing to add deferred functions
1269+ # to the overload tracker, otherwise we won't handle it correctly
1270+ for m in cdata .defer_protected_methods :
1271+ self ._on_class_method_process_overload_only (state , m )
1272+ for m in cdata .defer_private_virtual_methods :
1273+ self ._on_class_method_process_overload_only (state , m )
1274+
1275+ for m in cdata .defer_private_nonvirtual_methods :
1276+ self ._on_class_method_process_overload_only (state , m )
1277+
12451278 #
12461279 # Function/method processing
12471280 #
0 commit comments