Bug 12660 – Wrong non-@nogc function invariant error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-26T23:32:00Z
Last change time
2014-05-26T17:36:48Z
Keywords
diagnostic, pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-04-26T23:32:07Z
I don't understand this: class Foo { this() @nogc {} @nogc invariant() {} } void main() {} DMD 2.066alpha gives: test.d(2,5): Error: @nogc function 'test.Foo.this' cannot call non-@nogc function 'test.Foo.__invariant' Currently this bug has severity "normal", but if this issue is valid then it could be regarded as blocker for the release of 2.066.
Comment #1 by yebblies — 2014-05-12T16:00:37Z
I vaguely recall this being about attributes on the LHS of invariants being ignored.
Comment #2 by bearophile_hugs — 2014-05-12T17:15:16Z
(In reply to yebblies from comment #1) > I vaguely recall this being about attributes on the LHS of invariants being > ignored. If I put @nogc on the right: class Foo { this() @nogc {} invariant() @nogc {} } void main() {} temp.d(3,17): Error: statement expected to be { }, not @ temp.d(3,23): Error: basic type expected, not { temp.d(3,23): Error: no identifier for declarator int temp.d(3,23): Error: Declaration expected, not '{' temp.d(5,15): Error: } expected following member declarations in aggregate
Comment #3 by yebblies — 2014-05-12T18:17:41Z
Different problem.
Comment #4 by k.hara.pg — 2014-05-26T07:57:17Z
Comment #5 by github-bugzilla — 2014-05-26T17:36:47Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dae8ad7b17a18e6f1aad85a2fab1bf32bce28910 fix Issue 12660 - Wrong non-@nogc function invariant error https://github.com/D-Programming-Language/dmd/commit/e9bb4a2e7c6a0c11d37c3fb8d655af980cae7feb Merge pull request #3586 from 9rnsr/fix12660 Issue 12660 - Wrong non-@nogc function invariant error