Thread overview
[Issue 1503] New: Type aliases and tuples of template instances
Sep 14, 2007
d-bugmail
Sep 15, 2007
d-bugmail
keywords
Sep 15, 2007
Brad Roberts
Oct 21, 2009
Max Samukha
Oct 11, 2010
Manuel König
September 14, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1503

           Summary: Type aliases and tuples of template instances
           Product: D
           Version: 1.021
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: samukha@voliacable.com


May be a duplicate of other tuple bugs.

template Foo(T)
{
    alias T Type;
}

template Foos(A...)
{
    alias A Foos;
}

alias Foos!(Foo!(int), Foo!(char)) foos;
foos[0].Type x = 20; // Fails
-----
Error: no identifier for declarator foos[0];

Works if a redundant typeof is added:
typeof(foos[0].Type) x = 20;


-- 

September 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1503


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
           Keywords|                            |rejects-valid




------- Comment #1 from smjg@iname.com  2007-09-15 09:26 -------
Please remember to assign keywords to bug reports.  To everybody reading this: Please look through issues you've reported and check for missing keywords.


-- 

September 15, 2007
d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=1503
> 
> 
> smjg@iname.com changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |smjg@iname.com
>            Keywords|                            |rejects-valid
> 
> 
> 
> 
> ------- Comment #1 from smjg@iname.com  2007-09-15 09:26 -------
> Please remember to assign keywords to bug reports.  To everybody reading this:
> Please look through issues you've reported and check for missing keywords.

The keywords are nice to haves, but definitely not required.  I wouldn't spend a lot of time doing this sort of post-bug filing fixup.  Walter, speak up if you rely on them for prioritization, but I've never heard you mention them before.

Later,
Brad

October 21, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1503



--- Comment #2 from Max Samukha <samukha@voliacable.com> 2009-10-21 01:27:05 PDT ---
An extra alias can be added to stop the gap:

template Foo(T)
{
    alias T Type;
}

template Foos(A...)
{
    alias A Foos;
}

alias Foos!(Foo!(int), Foo!(char)) foos;
alias foos[0] foo;
foo.Type x = 20;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 11, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1503


Manuel König <manuelk89@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |manuelk89@gmx.net
         Resolution|                            |DUPLICATE
         OS/Version|Windows                     |All


--- Comment #3 from Manuel König <manuelk89@gmx.net> 2010-10-11 12:36:17 PDT ---
The typeof(foos[0].Type) x = 20; trick doesn't work for me, but aliasing the array index expr works. This is a duplicate of #3085, which means no declaration of the form

a[0].t x;

is possible because the parser does not accept that syntax, even when t is a type. Your alias trick bypasses that limitation, that's why it works.

*** This issue has been marked as a duplicate of issue 3085 ***

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