Skip to content

Commit

Permalink
fix Issue 7369 - Inout constructor causes compiler to reject invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jan 29, 2012
1 parent 3c99519 commit 3c13871
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/doc.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// Compiler implementation of the D programming language
// Copyright (c) 1999-2011 by Digital Mars
// Copyright (c) 1999-2012 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
Expand Down
1 change: 1 addition & 0 deletions src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -3753,6 +3753,7 @@ void InvariantDeclaration::semantic(Scope *sc)

sc = sc->push();
sc->stc &= ~STCstatic; // not a static invariant
sc->stc |= STCconst; // invariant() is always const
sc->incontract++;
sc->linkage = LINKd;

Expand Down
5 changes: 5 additions & 0 deletions test/fail_compilation/fail7369.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
struct S7369 {
int a;
invariant() { a += 5; }
}

2 changes: 1 addition & 1 deletion test/runnable/testdstress.d
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void test2()
class MyClass3
{

private int g() {
private int g() const {
return 1;
}

Expand Down

0 comments on commit 3c13871

Please sign in to comment.