www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - unittest can't access private data in parametrized class, also link error

I'm seeing two errors with parametrized classes and/or unittests.

Put this in a single module and try compiling 
(I used "dmd -unittest -c test.d")

 class X(Y) {
    private void foo() { }
 unittest {
    X!(int) x = new X!(int);

you'll get "class X member foo is not accessible"

I'm also getting a linking error if the parametrized class is
instantiated twice with the same types in different object files:

 module test;
 class X(Y) {
    void foo() { }
 unittest {
    X!(int) x = new X!(int);
 import test;
 int main() {
    X!(int) t = new X!(int);
    return 0;


dmd -c -unittest test.d
dmd test2.d -unittest test.obj

results in

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

test.obj(test)  Offset 002F4H Record Type 00C3
 Error 1: Previous Definition Different : _D4test3X_i1X3fooFZv
--- errorlevel 1
Sep 22 2004