www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11920] New: Rvalue aggregate contains lvalues

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11920

           Summary: Rvalue aggregate contains lvalues
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



//----
struct S{int i;} 

S foo();

void main()
{
    foo().i = 5;
    int* p = &foo().i;
}
//----

The above compiles just fine. However, (AFAIK) it is an error: The members of
an rvalue should themselves be rvalues. (or would that be an ER?)

I think both the examples above should be rejected.

It has sparked bugs such as:
http://d.puremagic.com/issues/show_bug.cgi?id=11889

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11920


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei erdani.com



PST ---
Yah, I think we need to fix this (even if we disallow the last line).

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2014