Use of `this` in operators
<p>I have something like this:</p>

<pre><code>CLASS CLASS::operator|(CLASS&amp; right) {
    return binop(*((CLASS*) this), right, OP_OR);
}
</code></pre>

<p>CLASS is just some class. 
binop's prototype is</p>

<p><code>CLASS binop(CLASS&amp; left, CLASS&amp; right, OP op);</code></p>

<p>This all works fine and compiles using Visual C++ 2010 but fails in g++ with an error:</p>

<pre><code>someheader.h: In member function 'void CLASS::set(int64_t)':
someheader.h:469:29: error: no match for 'operator|' in '*(CLASS*)this | CLASS(bit)'
someheader.h:469:29: note: candidate is:
someheader.h:376:1: note: CLASS CLASS::operator|(CLASS&amp;)
someheader.h:376:1: note:   no known conversion for argument 1 from 'CLASS' to 'CLASS&amp;'
</code></pre>

<p>Now, I'm having problems just passing the current object (*this) as some parameter, so I explicitly cast out it to remove the <code>const</code> qualifier on the pointer, which works fine and seems to trick the Visual C++ compiler to accept it as a normal pointer. g++ doesn't seem to like this. If I remove the cast, it still give me an error since <code>this</code> is const-qualified. What I do with the left- and right-hand size of the operators requires that both are mutable. </p>

<p>From what I can gather, it seems that there's an issue with me passing some object and converting it to a reference in the function call... Which doesn't make much sense to me. Any suggestions?</p>
