Thread overview
[help please] dmd crashes on migration to templated version
Feb 26, 2004
Manfred Nowak
Feb 26, 2004
Walter
Feb 27, 2004
Manfred Nowak
Mar 04, 2004
Manfred Nowak
Mar 06, 2004
Walter
February 26, 2004
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.
February 26, 2004
I can't tell without a reproducible code example.


February 27, 2004
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.
March 04, 2004
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();
}
March 06, 2004
Thanks, I'll take it from here.