Mercurial > projects > ldc
comparison dmd/staticassert.c @ 1615:3da302cc4966
Merge DMD r294: bugzilla 2816 Sudden-death static assert is not...
bugzilla 2816 Sudden-death static assert is not very useful.
---
dmd/expression.h | 12 ++++++
dmd/staticassert.c | 10 +---
dmd/template.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++----
dmd/template.h | 2 +
4 files changed, 117 insertions(+), 15 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:21 -0300 |
parents | 1b24e9c7cc26 |
children |
comparison
equal
deleted
inserted
replaced
1614:dbf7b54f542f | 1615:3da302cc4966 |
---|---|
16 #include "expression.h" | 16 #include "expression.h" |
17 #include "id.h" | 17 #include "id.h" |
18 #include "hdrgen.h" | 18 #include "hdrgen.h" |
19 #include "scope.h" | 19 #include "scope.h" |
20 #include "template.h" | 20 #include "template.h" |
21 #include "declaration.h" | |
21 | 22 |
22 | 23 |
23 /********************************* AttribDeclaration ****************************/ | 24 /********************************* AttribDeclaration ****************************/ |
24 | 25 |
25 StaticAssert::StaticAssert(Loc loc, Expression *exp, Expression *msg) | 26 StaticAssert::StaticAssert(Loc loc, Expression *exp, Expression *msg) |
46 | 47 |
47 void StaticAssert::semantic(Scope *sc) | 48 void StaticAssert::semantic(Scope *sc) |
48 { | 49 { |
49 } | 50 } |
50 | 51 |
51 #include "scope.h" | |
52 #include "template.h" | |
53 #include "declaration.h" | |
54 | |
55 void StaticAssert::semantic2(Scope *sc) | 52 void StaticAssert::semantic2(Scope *sc) |
56 { | 53 { |
57 Expression *e; | 54 Expression *e; |
58 | 55 |
59 //printf("StaticAssert::semantic2() %s\n", toChars()); | 56 //printf("StaticAssert::semantic2() %s\n", toChars()); |
71 msg->toCBuffer(&buf, &hgs); | 68 msg->toCBuffer(&buf, &hgs); |
72 error("%s", buf.toChars()); | 69 error("%s", buf.toChars()); |
73 } | 70 } |
74 else | 71 else |
75 error("(%s) is false", exp->toChars()); | 72 error("(%s) is false", exp->toChars()); |
76 if(sc->tinst) | 73 if (sc->tinst) |
77 sc->tinst->printInstantiationTrace(); | 74 sc->tinst->printInstantiationTrace(); |
78 if (!global.gag) { | 75 if (!global.gag) |
79 fatal(); | 76 fatal(); |
80 } | |
81 } | 77 } |
82 else if (!e->isBool(TRUE)) | 78 else if (!e->isBool(TRUE)) |
83 { | 79 { |
84 error("(%s) is not evaluatable at compile time", exp->toChars()); | 80 error("(%s) is not evaluatable at compile time", exp->toChars()); |
85 } | 81 } |