www.digitalmars.com         C & C++   DMDScript  

D - [help please] dmd crashes on migration to templated version

reply Manfred Nowak <svv1999 hotmail.com> writes:
I have a class C that compiles and runs correctly.

Now I want to make it type dependent.

C contains a Type that is declared like:
  typedef uint T;

In a first step I move this declaration out of the body of C into the
module level and put a template declaration around the declaration of C
like this:

  typedef uint T;

  template CTemp(T){
    class C{
       ...  //no more typedef for T in here
    }
  }

I instantiate the template and declare the class object like this:

  alias CTemp!(T) TC;

  TC.C  foo= new TC.C( ... parameters for this ... );

What am I doing wrong, that make dmd crash in the semantic3 phase?

So long.
Feb 26 2004
parent reply "Walter" <walter digitalmars.com> writes:
I can't tell without a reproducible code example.
Feb 26 2004
next sibling parent Manfred Nowak <svv1999 hotmail.com> writes:
Walter wrote:

 I can't tell without a reproducible code example.

Then there is no obvious error. I will try to track it down. So long.
Feb 27 2004
prev sibling parent reply Manfred Nowak <svv1999 hotmail.com> writes:
Walter wrote:
 I can't tell without a reproducible code example.

I reduced the code to: template CT(T){ class C{ const char[][] arrArr=["" ]; } } void main(){ alias CT!(int) Ct; Ct.C c= new Ct.C(); } While this crashes the untemplated version compiles okay: class C{ const char[][] arrArr=["" ]; } void main(){ C c= new C(); }
Mar 04 2004
parent "Walter" <walter digitalmars.com> writes:
Thanks, I'll take it from here.
Mar 05 2004