[Issue 2279] alias within function template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 12 07:41:32 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2279


2korden at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from 2korden at gmail.com  2008-08-12 09:41 -------
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


-- 



More information about the Digitalmars-d-bugs mailing list