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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3781 - ICE(interpret.c): using no-argument C-style variadic function in CTFE
Summary: ICE(interpret.c): using no-argument C-style variadic function in CTFE
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
Reported: 2010年02月08日 00:52 UTC by strtr
Modified: 2014年04月18日 09:12 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description strtr 2010年02月08日 00:52:11 UTC
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 Don 2010年02月09日 00:25:05 UTC
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 Don 2010年02月09日 01:21:47 UTC
Oops, there's a missing parentheses. Should be:
if (tf->varargs && arguments && ((parameters && arguments->dim !=
parameters->dim) || (!parameters && arguments->dim)))
Comment 3 Walter Bright 2010年02月11日 22:26:10 UTC
Changeset 376
Comment 4 Walter Bright 2010年03月08日 22:23:42 UTC
Fixed dmd 1.057 and 2.041


AltStyle によって変換されたページ (->オリジナル) /