public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38870]  New: G++ allows modification of data members for a non lvalue object
@ 2009-01-16 12:04 stefan dot constantin at gmail dot com
  2009-01-16 12:11 ` [Bug c++/38870] " stefan dot constantin at gmail dot com
  2009-01-16 20:33 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: stefan dot constantin at gmail dot com @ 2009-01-16 12:04 UTC (permalink / raw)
  To: gcc-bugs

taking into account the following program
-------------------------------------------------
class tester {
public:
        int i;
        void foo() {}
};

int main()
{
        tester().foo();
        tester().i = 10;
        return 0;
}
-------------------------------------------------

The C++ standard (under 3.10.2 lvalues and rvalues) specifies that the result
from tester() is not an lvalue but implementations can invoke member functions
on the rvalue.
In this case tester().foo() is permitted, which is ok, but tester().i =
something should not be permitted since the implementation is only allowed to
invoke member functions.

Thank you,

Stefan Constantin


-- 
           Summary: G++ allows modification of data members for a non lvalue
                    object
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stefan dot constantin at gmail dot com
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38870


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-16 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-16 12:04 [Bug c++/38870] New: G++ allows modification of data members for a non lvalue object stefan dot constantin at gmail dot com
2009-01-16 12:11 ` [Bug c++/38870] " stefan dot constantin at gmail dot com
2009-01-16 20:33 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).