www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11166] New: Forward reference error when alias of template instance is private

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich 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: -------
Oct 03 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11166



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-10-03
18:42:36 PDT ---
(In reply to comment #0)
 snip
Also: If you remove the ctor it will compile. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 03 2013