Summary: Regression(DMD 2.053) ICE on typeof(Range.init[0..$])
                    inside a templated struct/class
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: regression
          Priority: P2
         Component: DMD

--- Comment #0 from Rob Jacques <> 2011-07-01 13:51:56 PDT ---
This is a regression between DMD 2.052 and DMD 2.053. Here is a very reduced
test case:

struct Bug(Range) { pragma(msg, typeof(Range.init[0..$]) ); }

void main(string[] args) {
    Bug!(ubyte[]) bug;

The issue also effect classes and is statements, i.e.

    enum useSlicing = is(typeof(Range.init[0..$]) : const ubyte[] );

This problem seems to be limited to the use of a template parameter inside a
struct/class defined outside of the current scope. All of the following

void main(string[] args) {
    pragma(msg, typeof((ubyte[]).init[0..$]) );

    alias ubyte[] Range;
    pragma(msg, typeof(Range.init[0..$]) );

    struct NotBug(Range2) { pragma(msg, typeof(Range2.init[0..$]) ); }
    NotBug!(ubyte[]) notBug; 

This bug can be worked around by placing the statement inside its own
sub-template. I.e:

struct Bug(Range) {
    template UseSlicing(__Range) {
        enum UseSlicing = is(typeof(__Range.init[0..$]) : const ubyte[] );
    pragma(msg, UseSlicing!Range);

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to