[Issue 11166] New: Forward reference error when alias of template instance is private

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 3 18:34:04 PDT 2013


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

           Summary: Forward reference error when alias of template
                    instance is private
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-10-03 18:34:03 PDT ---
This is a weird one:

-----
template Tup(T...) { alias Tup = T; }

struct S
{
    enum S a = S(0);
    enum S b = S(1);

    this(long value) { }
    long value;

    // only triggered when private and a template instance.
    private alias types = Tup!(a, b);
}

void main() { }
-----

test.d(5): Error: cannot create a struct until its size is determined
test.d(6): Error: cannot create a struct until its size is determined

Note, there is also the following bug where I've accidentally used an enum
instead of an alias in the Tuple definition:

template Tup(T...) { enum Tup = T; }

Using this with the above test-case causes the same diagnostics, but also
crashes DMD (git-head). In 2.063.2 it doesn't crash but instead creates an
additional diagnostic:

test.d(12): Error: template instance bad1.Tup!(__error, __error) error
instantiating

-- 
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