Mercurial > projects > ldc
annotate lphobos/std/outofmemory.d @ 1605:1d5721f9ae18
[WIP] Merge DMD r251: bugzilla 111 (appending a dchar to a char[])
This patch needs some work in the code generation, because of the runtime
changes (functions "_d_arrayappendcd" and "_d_arrayappendwd" are added).
This doesn't affect existing code though, it just makes with patch
a little useless, because something like this:
char [] s;
s ~= '\u6211';
That failed to compile with a nice error message previously to this
change, now fails with and ugly error message (a failed assertion).
Apparently there is a regression introduced by this patch too, when
compiling Dil I get this assertion message:
ldc: /home/luca/tesis/ldc/gen/statements.cpp:132: virtual void ReturnStatement::toIR(IRState*): Assertion `p->topfunc()->getReturnType() == llvm::Type::getVoidTy(gIR->context())' failed.
0 ldc 0x08a91628
Thank god we have bisecting capabilities in VCSs now ;)
---
dmd/expression.c | 47 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 41 insertions(+), 6 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:19 -0300 |
parents | 88e23f8c2354 |
children |
rev | line source |
---|---|
89 | 1 /** |
2 * Macros: | |
3 * WIKI=Phobos/StdOutOfMemory | |
4 * Copyright: | |
5 * Placed into public domain. | |
6 * www.digitalmars.com | |
7 */ | |
8 | |
9 | |
10 module std.outofmemory; | |
11 | |
12 /****** | |
13 * This exception is thrown when out of memory errors happen. | |
14 */ | |
15 | |
16 class OutOfMemoryException : Exception | |
17 { | |
18 static char[] s = "Out of memory"; | |
19 | |
20 /** | |
21 * Default constructor | |
22 */ | |
23 this() | |
24 { | |
25 super(s); | |
26 } | |
27 | |
28 char[] toString() | |
29 { | |
30 return s; | |
31 } | |
32 } | |
33 | |
34 extern (C) void _d_OutOfMemory() | |
35 { | |
662
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
36 printf("Out of memory!\n"); |
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
37 *(cast(int*) 0) = 0; |
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
38 throw cast(OutOfMemoryException) |
89 | 39 cast(void *) |
662
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
40 OutOfMemoryException.classinfo.init; |
89 | 41 } |
42 | |
43 static this() | |
44 { | |
45 } |