www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19098] New: Improve error for non-assignable struct

https://issues.dlang.org/show_bug.cgi?id=19098

          Issue ID: 19098
           Summary: Improve error for non-assignable struct
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: razvan.nitu1305 gmail.com

struct A
{
    const int a;                                                                
    this(int) {}
}

void main()
{
    A a = A(2);
    A b = A(3);
    a = b;
}

Error: cannot modify struct a A with immutable members

A does not contain any immutable members. Error message should be:

cannot modify struct instance a of type A because it contains non-mutable
members

--
Jul 19 2018