OSL Struct SyntaxError
You should declare the variable inside a shader

struct complex {
    color r;
    color i;
};

shader node_complex(output float result=0.0)
{
    complex test;
}


This will resolve the compilation error. The issue is that Global variables in OSL are predefined and it is not possible to create custom global variables.

You can use these structs inside shaders and pass it around.