Bug 3330 – Compiler rejects mixin templates that generate moderately long code;

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-09-18T14:20:00Z
Last change time
2015-06-09T01:26:48Z
Keywords
rejects-valid
Assigned to
nobody
Creator
peng2cheng2

Attachments

IDFilenameSummaryContent-TypeSize
458bug.da good mixin template(?) that dmd 2 cannot evaluatetext/x-dsrc3783

Comments

Comment #0 by peng2cheng2 — 2009-09-18T14:20:21Z
Created attachment 458 a good mixin template(?) that dmd 2 cannot evaluate Mixin template tests out fine, except if the generated code gets moderately long. See attached file for example. When mixin produces the longer code, the compiler produces following. pc_ut$> dmd dcsv_ut.d -L-lpcd2 /opt/d2/src/druntime/import/core/memory.di(162): Error: cannot evaluate gc_malloc(sz,ba) at compile time /opt/d2/src/phobos/std/conv.d(2517): Error: cannot evaluate malloc(12u,2u) at compile time /opt/d2/src/phobos/std/conv.d(2987): Error: cannot evaluate to(_param_0) at compile time /opt/d2/src/phobos/std/conv.d(3003): Error: cannot evaluate textImpl(_param_0) at compile time /home/pc/d2libs/src/pcd2/pc/dcsv.d(306): Error: cannot evaluate text(i) at compile time /home/pc/d2libs/src/pcd2/pc/dcsv.d(331): Error: cannot evaluate makeCSVRowMixin("struct ChartDataRow","\x0along fld1; ostring tb_group; long fld2; ostring fs_group; \x0along fld3; ostring fs_line; long fld4; ostring account_group; \x0along fld5; ostring account; long acct_id; ostring print_name;\x0a",",\"") at compile time /home/pc/d2libs/src/pcd2/pc/dcsv.d(331): Error: argument to mixin must be a string, not (makeCSVRowMixin("struct ChartDataRow","\x0along fld1; ostring tb_group; long fld2; ostring fs_group; \x0along fld3; ostring fs_line; long fld4; ostring account_group; \x0along fld5; ostring account; long acct_id; ostring print_name;\x0a",",\"")) dcsv_ut.d(49): Error: mixin dcsv_ut.CSVRow!("struct ChartDataRow",csvChartDataFields) error instantiating /home/pc/d2libs/src/pcd2/pc/dcsv.d(331): Error: cannot evaluate makeCSVRowMixin("struct XRow","long i; javastr s; double d; SqlDate dt",",\"") at compile time /home/pc/d2libs/src/pcd2/pc/dcsv.d(331): Error: argument to mixin must be a string, not (makeCSVRowMixin("struct XRow","long i; javastr s; double d; SqlDate dt",",\"")) dcsv_ut.d(52): Error: mixin dcsv_ut.CSVRow!("struct XRow","long i; javastr s; double d; SqlDate dt") error instantiating
Comment #1 by bugzilla — 2009-12-06T03:55:43Z
Test case fails to compile with: bug.d(11): Error: identifier 'SqlDate' is not defined Please fix & reopen.