[Issue 5988] Template accepts instantiating an already-instantiated template type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 18 03:11:14 PDT 2013


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



--- Comment #5 from Kenji Hara <k.hara.pg at gmail.com> 2013-05-18 03:11:11 PDT ---
(In reply to comment #3)
> Yeah, this is an accepts-invalid for this test-case:
> 
> template Templ(alias T)
> {
>     alias T!int Templ;
> }
> 
> class C(T)
> {
>     Templ!(C) foo;  // should be NG, must use Templ!(.C)
> }
> 
> Templ!C foo;
> 
> void main()
> {
>     C!int a;
> }

No. This is rejects-valid issue. Templ!(C) would capture class C (not template
C), BUT, inside Templ, T!int should be translated to the instantiation of
template C.

The behavior is consistent with the following:

class C(T) {
    void foo() {
        C!long c;
        // here 'C' points class (not template), but C!long will
        // automatically translated to the template C instantiation.
    }
}
C!int c;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list