﻿# V678\. Object is used as an argument to its own method\. Consider checking the first actual argument of the 'Foo' function\.

The analyzer has detected a call to a non\-static member function in which the object itself was passed as the first argument\.

```cpp
A.Foo(A);
```

This code may probably contain an error\. For example, an incorrect variable name is used because of a misprint\. The correct code should look like this then:

```cpp
A.Foo(B);
```

or like this:

```cpp
B.Foo(A);
```

Let's see how such misprints may affect the code in real life\. Here's a fragment from a real application:

```cpp
CXMLAttribute* pAttr1 =
  m_pXML->GetAttribute(CXMLAttribute::schemaName);
CXMLAttribute* pAttr2 =
  pXML->GetAttribute(CXMLAttribute::schemaName);
if ( pAttr1 && pAttr2 &&
     !pAttr1->GetValue().CompareNoCase(pAttr1->GetValue()))
  ....
```

This code should compare two attributes\. But a misprint causes the value "pAttr1\-\>GetValue\(\)" to be compared to itself\.

This is the fixed code:

```cpp
if ( pAttr1 && pAttr2 &&
     !pAttr1->GetValue().CompareNoCase(pAttr2->GetValue()))
```