← Back to index
|
Original Bugzilla link
Bug 684 – dmd should compile this
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-12-13T01:43:00Z
Last change time
2014-02-15T13:20:53Z
Assigned to
bugzilla
Creator
davidl
Comments
Comment #0
by davidl — 2006-12-13T01:43:48Z
import std.stdio; class hello { template a(AnotherT,char[] name,T...){ AnotherT a(M...)(M m){ AnotherT localchar; foreach(a;T) { writefln(`hello`); localchar~=a.mangleof; } return cast(AnotherT)localchar; } } } void main() { char[] b="adf"; uint i=123; char[3] c="Adf"; auto a=new hello; a.a!(typeof(b),"adf")(); } dmd output: testvararg2.d(23): Error: function expected before (), not 'a dotexp template a( M...)' Let's see what would happen if it's not in a class import std.stdio; template a(AnotherT,char[] name,T...){ AnotherT a(M...)(M m){ AnotherT localchar; foreach(a;T) { writefln(`hello`); localchar~=a.mangleof; } return cast(AnotherT)localchar; } } void main() { char[] b="adf"; uint i=123; char[3] c="Adf"; writefln(a!(typeof(b),"Adf")()); } works & compiles as my expectation
Comment #1
by bugzilla — 2006-12-27T02:04:09Z
Fixed DMD 0.178
Comment #2
by thomas-dloop — 2006-12-30T09:49:55Z
Added to DStress as
http://dstress.kuehne.cn/run/t/tuple_11_A.d
http://dstress.kuehne.cn/run/t/tuple_11_B.d
http://dstress.kuehne.cn/run/t/tuple_11_C.d
http://dstress.kuehne.cn/run/t/tuple_11_D.d
http://dstress.kuehne.cn/run/t/tuple_11_E.d
http://dstress.kuehne.cn/run/t/tuple_11_F.d
http://dstress.kuehne.cn/run/t/tuple_11_G.d
http://dstress.kuehne.cn/run/t/tuple_11_H.d