[Issue 8028] New: Templates sometimes-can/sometimes-can't access private symbols in same module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 3 17:15:39 PDT 2012


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

           Summary: Templates sometimes-can/sometimes-can't access private
                    symbols in same module
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: cbkbbejeap at mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2012-05-03 17:16:53 PDT ---
----------------------
// test1.d
import test2;
auto a = foo!1;
----------------------
// test2.d
template foo(int i)
{
    immutable foo = makeStruct(i); // A
    //immutable foo = MyStruct(i); // B
}

private MyStruct makeStruct(int i)
{
    return MyStruct(i);
}

struct MyStruct
{
    private this(int i) {}
}
----------------------

In test2.d, using the line marked "A" compiles successfully, but using the line
marked "B" results in:

Error: struct test2.MyStruct member this is not accessible

I don't know whether they're supposed to both succeed or both fail, but that
fact that one works and the other doesn't sounds like a compiler bug to me.

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