// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

// A function that tries verious ways to write to its non-output params
float func (float x, int i)
{
    x = 0;
    x += 3;
    ++i;
    i++;
    return x*x;
}



void g(output float b) {
    b = 1;  // ok, since b is marked as output
}

void f(float a) {
    g(a);  // <--- should be disallowed, a is not output, but the arg of g() is output
}



shader test ()
{
    float y = 1;
    int j = 1;
    float z = func(y, j);
    printf ("z=%g\n", z);

    // Try writing to non-writeable global
    u = 0;

    // Try transitive write through f and g -- this used to be a missed error
    f(y);
}
