1 Reply Latest reply on Jan 24, 2013 5:31 PM by C Project Lead-Oracle

    C99 interpretation bug in c99 compiler?

      This code snippet came up on a recent Usenet discussion:

      struct toto { const int i; const float f; const void *p; };

      struct toto foo(int i, float f, void *p)
      return (struct toto){i, f, p};

      and the consensus was it should compile, but c99 reports:

      left operand must be modifiable lvalue: op "="

      for the return statement. p3 states

      "the value of the expression is returned to the caller as the value of the function call expression"

      and the footnote for that section reads

      "The return statement is not an assignment. The overlap restriction of subclause does not apply to the case of function return".