1 Reply Latest reply on Jun 5, 2012 4:01 PM by marc1842fr

    Compile error: Returning a local object to a reference variable

      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