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


--- Comment #0 from monarchdodra gmail.com 2014-01-13 11:44:59 PST ---
//----
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


--- Comment #1 from Andrei Alexandrescu <andrei erdani.com> 2014-01-13 11:49:22
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