Bug 2904 – (D1 only) template instantiation of non template allowed
Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2009-04-27T06:02:01Z
Last change time
2019-08-10T13:55:28Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Tomas Lindquist Olsen
Comments
Comment #0 by tomas — 2009-04-27T06:02:01Z
DMD accepts the following code:
bar.d:
=========
class A {
void method(char[] f) {}
}
static this() {
(new A).method!()("foo");
//(new A).method("foo");
}
=========
$ dmd bar.d -c
$ nm bar.o | grep method
00000000 T _D3bar12_staticCtor1FZv6methodMFAaZv
$
If valid syntax is used the symbol is correct:
bar.d:
=========
class A {
void method(char[] f) {}
}
static this() {
//(new A).method!()("foo");
(new A).method("foo");
}
=========
$ dmd bar.d -c
$ nm bar.o | grep method
00000000 T _D3bar1A6methodMFAaZv
$
I got this from LDC ticket: http://dsource.org/projects/ldc/ticket/261
So apparently people are using this for something :/ The AST seems somewhat broken, so making it work none-the-less (which of course we shouldn't) in LDC seems a bit problematic.
Comment #1 by hoganmeier — 2011-09-05T04:42:33Z
Seems like this one has been fixed in the meantime.
dmd 2.055 gives:
Error: (new A).method isn't a template