Bug 8602 – ICE(mtype.c) string mixin + auto return type + template tuple

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-30T14:20:00Z
Last change time
2013-02-05T21:05:08Z
Keywords
ice
Assigned to
nobody
Creator
ellery-newcomer

Comments

Comment #0 by ellery-newcomer — 2012-08-30T14:20:43Z
dmd 2.060 code: template ReturnType(func...) if (func.length == 1) { } struct BinaryOperatorX(string _op, rhs_t,C) { ReturnType!(mixin("C.opBinary!(_op,rhs_t)")) RET_T; } class MyClass { auto opBinary(string op, T)() { } } void PydMain() { BinaryOperatorX!("+", int, MyClass); } fireworks: dmd: mtype.c:5254: virtual void TypeFunction::toDecoBuffer(OutBuffer*, int): Assertion `next' failed.
Comment #1 by hsteoh — 2012-11-23T16:30:34Z
This is an internal compiler error; it deserves some attention. Also, confirmed that it still happens in latest git dmd.
Comment #2 by clugdbug — 2012-11-26T07:44:06Z
Very marginally simplified. If you take out the "if (func.length == 1)" then it segfaults instead. ------------- template ReturnType(func...) if (func.length == 1) { } struct MyClass { auto xopBinary(T)() { } } struct BinaryOperatorX() { ReturnType!(mixin("MyClass.xopBinary!(int)")) RET_T; } void PydMain() { BinaryOperatorX!(); }
Comment #3 by clugdbug — 2012-11-28T00:51:37Z
Further reduced. ------------------ template T8602(func...) if (func.length == 1) { } struct Bug8602 { auto xx() { } } T8602!(mixin("Bug8602.xx")) mm;
Comment #4 by clugdbug — 2012-11-28T00:53:41Z
The problem is that at the end of CompileExp::semantic, the result is xx, but the type of xx is still not known because it was a return-type inferred function.
Comment #5 by andrej.mitrovich — 2013-02-04T13:45:19Z
(In reply to comment #3) > Further reduced. > ------------------ > template T8602(func...) if (func.length == 1) { } > > struct Bug8602 { > auto xx() { } > } > > T8602!(mixin("Bug8602.xx")) mm; The ICE is gone in git-head, now only gives: Error: T8602!(xx) is used as a type
Comment #6 by k.hara.pg — 2013-02-05T21:05:08Z
(In reply to comment #5) > (In reply to comment #3) > > Further reduced. > > ------------------ > > template T8602(func...) if (func.length == 1) { } > > > > struct Bug8602 { > > auto xx() { } > > } > > > > T8602!(mixin("Bug8602.xx")) mm; > > The ICE is gone in git-head, now only gives: > > Error: T8602!(xx) is used as a type This is correct behavior, because T8602!(Bug8602.xx) does not make a type. Maybe this is a dup of bug 5933.