Bug 2279 – alias within function template

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-08-12T09:16:00Z
Last change time
2014-03-01T00:35:55Z
Assigned to
bugzilla
Creator
Daniel919

Comments

Comment #0 by Daniel919 — 2008-08-12T09:16:12Z
template Test(T) { alias int V; void test(T t) {} } Test!(int).test(0); //OK template test(T) { alias int V; void test(T t) {} } test!(int)(0); //Error test(0) //Error template test(T) { void test(T t) {} } test!(int)(0); //OK test(0); //OK
Comment #1 by 2korden — 2008-08-12T09:41:29Z
This is not a bug, it is by desing. If you create exactly one symbol (an alias, variable or a function) and it matches the template name, you can access it without fully qualified name, like this: template foo() { const int foo = 42; } const int f = foo(); but if you introduce a second symbol then you should fully specify it: template foo() { void foo() {} int bar(int i) { return i; } } foo!().foo(); int bar = foo!().bar(42); http://www.digitalmars.com/d/1.0/template.html