D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3085 - Cannot index tuple in declaration
Summary: Cannot index tuple in declaration
Status: RESOLVED DUPLICATE of issue 1215
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P2 enhancement
Assignee: No Owner
URL:
Keywords: patch, spec
: 1503 2446 (view as issue list)
Depends on:
Blocks:
 
Reported: 2009-06-19 22:09 UTC by Shin Fujishiro
Modified: 2017-07-03 18:04 UTC (History)
4 users (show)

See Also:


Attachments
Patch (DMD 2.030) (5.12 KB, patch)
2009-06-19 22:09 UTC, Shin Fujishiro
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Shin Fujishiro 2009-06-19 22:09:59 UTC
Created attachment 400 [details]
Patch (DMD 2.030)

The current declaration syntax does not handle a qualified type with an intermediate segment which does tuple indexing.

For example, the following does not compile:
--------------------
import std.typetuple;
template Trait(alias v) { alias typeof(v) Type; }
alias TypeTuple!(Trait!(42)) List;
List[0].Type var; // -> "no identifier for declarator List[0]"
--------------------
The compiler cannot parse "List[0].Type" as a type.

The attached patch enables the compiler to handle such intermediate tuple indexing with a slight change to the BasicType2 syntax:
--------------------
BasicType2:
        *
        [ ]
        [ Expression ]
        [ Expression .. Expression ]
        [ Type ]
        delegate Parameters FunctionAttributes_opt
        function Parameters FunctionAttributes_opt
        . IdentifierList    // !! Add this
--------------------
Comment 1 Manuel König 2010-10-11 12:36:18 UTC
*** Issue 1503 has been marked as a duplicate of this issue. ***
Comment 2 Manuel König 2010-10-11 12:42:21 UTC
*** Issue 2446 has been marked as a duplicate of this issue. ***
Comment 3 Vladimir Panteleev 2017-07-03 18:04:20 UTC
Fixed by https://github.com/dlang/dmd/pull/4516.

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