1 Reply Latest reply: Jun 5, 2012 11:01 AM by marc1842fr RSS

    Compile error: Returning a local object to a reference variable

    941649
      Hi all...

      I just need to know that when I return from a function with a local object to a reference, I am getting a compile error (Error name is "badarglval2"). Actually I'm sure that the error is closely related to Sun Solaris Compiler. According to C++ specs, when I return a local object to a reference, the local object has to survive until the refence variable is destroyed. However it doesn't work as expected with Solaris compiler and I am not allowed referencing a local variable.. Is there anyone who can explain why it works like this?

      Thanks in advance...

      - Volkan

      Edited by: 938646 on 05.Haz.2012 00:46