Mercurial > projects > ddmd
comparison dmd/SymOffExp.d @ 135:af1bebfd96a4 dmd2037
dmd 2.038
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 13 Sep 2010 22:19:42 +0100 |
parents | 60bb0fe4563e |
children | af724d3510d7 |
comparison
equal
deleted
inserted
replaced
134:4251f96733f4 | 135:af1bebfd96a4 |
---|---|
18 import dmd.FuncDeclaration; | 18 import dmd.FuncDeclaration; |
19 import dmd.IntegerExp; | 19 import dmd.IntegerExp; |
20 import dmd.ErrorExp; | 20 import dmd.ErrorExp; |
21 import dmd.TY; | 21 import dmd.TY; |
22 import dmd.TOK; | 22 import dmd.TOK; |
23 import dmd.STC; | |
23 | 24 |
24 import dmd.backend.Symbol; | 25 import dmd.backend.Symbol; |
25 import dmd.backend.Util; | 26 import dmd.backend.Util; |
26 import dmd.backend.TYM; | 27 import dmd.backend.TYM; |
27 | 28 |
56 override void checkEscape() | 57 override void checkEscape() |
57 { | 58 { |
58 VarDeclaration v = var.isVarDeclaration(); | 59 VarDeclaration v = var.isVarDeclaration(); |
59 if (v) | 60 if (v) |
60 { | 61 { |
61 if (!v.isDataseg()) | 62 if (!v.isDataseg() && !(v.storage_class & (STC.STCref | STC.STCout))) |
62 { /* BUG: This should be allowed: | 63 { /* BUG: This should be allowed: |
63 * void foo() | 64 * void foo() |
64 * { int a; | 65 * { int a; |
65 * int* bar() { return &a; } | 66 * int* bar() { return &a; } |
66 * } | 67 * } |
67 */ | 68 */ |
68 error("escaping reference to local variable %s", v.toChars()); | 69 error("escaping reference to local %s", v.toChars()); |
69 } | 70 } |
70 } | 71 } |
71 } | 72 } |
72 | 73 |
73 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 74 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |