Skip to content

Commit ba73649

Browse files
committed
Fix casts to template types not checking for non-values
This would previously provoke an ICE
1 parent 9a8c8ca commit ba73649

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

py/dml/ctree.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,6 +3733,8 @@ def read(self):
37333733
+ '(_traitref_t) {_object_vtables[__id.id], __id};})')
37343734

37353735
def mkTraitUpcast(site, sub, parent):
3736+
if isinstance(sub, NonValue):
3737+
raise sub.exc()
37363738
typ = safe_realtype(sub.ctype())
37373739
assert dml.globals.object_trait
37383740
if isinstance(typ, TTrait):

test/1.4/errors/T_ENVAL.dml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ method init() {
4646
b.r1;
4747
/// ERROR ENVAL
4848
b.r2.f;
49+
50+
/// ERROR ENVAL
51+
cast([], t);
4952
}
5053

5154
// dev is not a value in 1.4. Need to capture this with a rather unnatural

0 commit comments

Comments
 (0)