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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
                 CC|                            |clugd...@yahoo.com.au


--- Comment #1 from Don <clugd...@yahoo.com.au> 2012-01-01 11:43:28 PST ---
According to the spec, I don't think this is supposed to work.
expression.html says:
----
Nested structs cannot be used as fields or as the element type of an array:

void foo() {
  int i = 7;
  struct SS {
    int x,y;
    int bar() { return x + i + 1; }
  }
  struct DD {
    SS s;  // error, cannot be field
  }
}
----
So creating such a struct by passing the nested struct as a template parameter
shouldn't work either. But, the compiler accepts the examples that the spec
says are errors. So I'm not sure if the bug is in the spec or the compiler.


The ICE is a variation of bug 6419, but where the nested struct is part of a
struct literal. Here's a test case with the same ICE, but this time where it's
part of an array.

void func2(T)(T t){
    T[2] s;
    s[0] = t;
}

static assert({
    struct InnerStruct{
        void func(){}
    }
    func2(InnerStruct());
    return true;
}());

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

Reply via email to