error C3646: 'closure' : unknown override specifier

Spectral picture Spectral · Dec 13, 2010 · Viewed 10.1k times · Source

I got the following error:

error C3646: 'closure' : unknown override specifier

The code:

void BaseOperator::mousebutton_cb(EventObject* sender, EventArgs* calldata, void* closure)
{
    xd3D::Operation::Operator::BaseOperator* operator = (xd3D::Operation::Operator::BaseOperator*)closure;
    MouseButtonEventArgs* e = (MouseButtonEventArgs*)calldata;
    if (e->Status == Down)
        operator->OnMouseButtonDown(e);
    else
        operator->OnMouseButtonUp(e);
}

Do you know why I have this error?

Answer

Johannes Schaub - litb picture Johannes Schaub - litb · Dec 13, 2010

operator is a keyword. The sequence operator = tries to declare an assignment operator which in your case would have a pointer parameter type. And your compiler wants to parse the very last closure as a special specifier like override (afaik an extension of MSVC), const or such.

Rename the variable to something else, like myoperator.