D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6162 - Remove "invariant" as alias for "immutable"
Summary: Remove "invariant" as alias for "immutable"
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 13:37 UTC by bearophile_hugs
Modified: 2011-12-12 03:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-06-15 13:37:33 UTC
In DMD 2.053 this code compiles with no errors, because "invariant" is an alias for "immutable" still:


void main() {
    invariant x = 10;
}


But I suggest to remove this alias soon because it causes me some troubles regarding Class/struct/enum invariants. 


DMD v2.053 compiles this with no errors:


struct Foo {
    invariant {}
}
struct Bar {
    invariant
}
class CFoo {
    invariant {}
}
class CBar {
    invariant
}
void main() {}


See bug 4325 for more info.
Comment 1 Kenji Hara 2011-12-12 02:45:10 UTC
In 2.057, Using 'invariant' keyword as a storage class has been deprecated.

https://github.com/D-Programming-Language/dmd/pull/477

https://github.com/D-Programming-Language/dmd/commit/67411b9968e5454026ea3552e1228d05245859c8