Bug 3781 – ICE(interpret.c): using no-argument C-style variadic function in CTFE

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2010-02-08T00:52:00Z
Last change time
2014-04-18T09:12:03Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
strtr

Comments

Comment #0 by strtr — 2010-02-08T00:52:11Z
void _mixin() { writefln( "" ); } void main() { mixin( _mixin ); } //Assertion failure: '!dim || (parameters && (parameters->dim == dim))' on line 140 in file 'interpret.c' With both D1.056 and D2.040
Comment #1 by clugdbug — 2010-02-09T00:25:05Z
Reduced test case for test suite: ----- void badvariadic(...) {} static assert(!is(typeof(mixin(badvariadic())))); --- PATCH: interpret.c line 118. The check for C-style variadics failed in the case where there were no non-variadic parameters. TypeFunction *tf = (TypeFunction *)tb; Type *tret = tf->next->toBasetype(); - if (tf->varargs && arguments && parameters && arguments->dim != parameters->dim) + if (tf->varargs && arguments && (parameters && arguments->dim != parameters->dim) || (!parameters && arguments->dim)) { cantInterpret = 1; error("C-style variadic functions are not yet implemented in CTFE"); return NULL; }
Comment #2 by clugdbug — 2010-02-09T01:21:47Z
Oops, there's a missing parentheses. Should be: if (tf->varargs && arguments && ((parameters && arguments->dim != parameters->dim) || (!parameters && arguments->dim)))
Comment #3 by bugzilla — 2010-02-11T22:26:10Z
Changeset 376
Comment #4 by bugzilla — 2010-03-08T22:23:42Z
Fixed dmd 1.057 and 2.041