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

--- Comment #0 from Nick Sabalausky <> 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:
------- You are receiving this mail because: -------

Reply via email to