@@ -69,6 +69,43 @@ public override bool VisitFunctionDecl(AST.Function function)
69
69
70
70
private bool CheckDefaultParametersForAmbiguity ( Function function , Function overload )
71
71
{
72
+ // detect if function and overload are copy assignment or move assignment operators
73
+ // if both are either one of those types, ignore move assignment operator
74
+ if ( function . OperatorKind == CXXOperatorKind . Equal && overload . OperatorKind == CXXOperatorKind . Equal &&
75
+ function . Parameters . Count == 1 && overload . Parameters . Count == 1 )
76
+ {
77
+ var functionParamType = function . Parameters [ 0 ] . Type ;
78
+ var overloadParamType = overload . Parameters [ 0 ] . Type ;
79
+
80
+ if ( functionParamType is PointerType && overloadParamType is PointerType )
81
+ {
82
+ var functionParamPointerType = functionParamType as PointerType ;
83
+ var overloadParamPointerType = overloadParamType as PointerType ;
84
+
85
+ var functionPointee = functionParamPointerType . GetPointee ( ) ;
86
+ var overloadPointee = overloadParamPointerType . GetPointee ( ) ;
87
+
88
+ functionPointee . TryGetClass ( out Class @functionPointeeClass ) ;
89
+ overloadPointee . TryGetClass ( out Class @overloadPointeeClass ) ;
90
+
91
+ if ( functionPointeeClass == function . Namespace && @overloadPointeeClass == overload . Namespace )
92
+ {
93
+ if ( functionParamPointerType . Modifier == PointerType . TypeModifier . RVReference &&
94
+ overloadParamPointerType . Modifier == PointerType . TypeModifier . LVReference )
95
+ {
96
+ function . ExplicitlyIgnore ( ) ;
97
+ return true ;
98
+ }
99
+ else if ( functionParamPointerType . Modifier == PointerType . TypeModifier . LVReference &&
100
+ overloadParamPointerType . Modifier == PointerType . TypeModifier . RVReference )
101
+ {
102
+ overload . ExplicitlyIgnore ( ) ;
103
+ return true ;
104
+ }
105
+ }
106
+ }
107
+ }
108
+
72
109
List < Parameter > functionParams = RemoveOperatorParams ( function ) ;
73
110
List < Parameter > overloadParams = RemoveOperatorParams ( overload ) ;
74
111
0 commit comments