D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5397 - Compiler error on struct with invariant and postblitz
Summary: Compiler error on struct with invariant and postblitz
Status: RESOLVED DUPLICATE of issue 3273
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-01 13:12 UTC by Alex Khmara
Modified: 2011-01-01 22:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Alex Khmara 2011-01-01 13:12:38 UTC
This code:
 
module properties;
 
struct PropertyList {
    invariant() {
       assert(1);
    }
 
    this(this) {
        _props = [];
    }
 
    string[] _props;
}
 
 
gives compiler error:
 
Error: __result = this is not mutable
Error: __result = this is not an lvalue
 
Without invariant all works good.
Comment 1 Alex Khmara 2011-01-01 13:14:12 UTC
It seems that I cannot set proper DMD version - It was on DMD 2.0.51, Linux x86
Comment 2 Don 2011-01-01 22:26:12 UTC
(In reply to comment #1)
> It seems that I cannot set proper DMD version - It was on DMD 2.0.51, Linux x86

You should just set version = D2 (the exact release number is useless information).
Same issue as bug 3273.

*** This issue has been marked as a duplicate of issue 3273 ***