Weird error when compiling.

Agustin agustin.l.alvarez at hotmail.com
Sat Oct 19 18:42:53 PDT 2013


On Sunday, 20 October 2013 at 01:41:58 UTC, Agustin wrote:
> I'm getting Assertion failure: 'thisval && thisval->op == 
> TOKclassreference' on line 4067 in file 'interpret.c' when 
> compiling this.
>
> public class Component {
>     ////////////////////////////////////////////////////////////
>     /// Component's unique id.
>     private hash_t id;
>     ....
>     ////////////////////////////////////////////////////////////
>     /// \brief Default constructor.
>     ///
>     /// \param[in] id   The id of the component
>     ////////////////////////////////////////////////////////////
>     public this(hash_t id) {
>         this.id = id;
>         this.active = true;
>         this.validated = true;
>     }
>
>
> }
>
> public class ComponentDetail(T) : Component {
>     ////////////////////////////////////////////////////////////
>     /// Component's ID as static member.
>     public static hash_t ID = typeid(T).toHash;
>
>     ////////////////////////////////////////////////////////////
>     /// \brief Default constructor.
>     ////////////////////////////////////////////////////////////
>     public this() {
>         super(ID);
>     }
> }

Sorry i clicked the post button :(. The full code is:

I'm getting Assertion failure: 'thisval && thisval->op ==
TOKclassreference' on line 4067 in file 'interpret.c' when
compiling this.

public class Component {
       ////////////////////////////////////////////////////////////
       /// Component's unique id.
       private hash_t id;
       ....
       ////////////////////////////////////////////////////////////
       /// \brief Default constructor.
       ///
       /// \param[in] id   The id of the component
       ////////////////////////////////////////////////////////////
       public this(hash_t id) {
           this.id = id;
           this.active = true;
           this.validated = true;
       }

       ....
}

public class ComponentDetail(T) : Component {
       ////////////////////////////////////////////////////////////
       /// Component's ID as static member.
       public static hash_t ID = typeid(T).toHash;

       ////////////////////////////////////////////////////////////
       /// \brief Default constructor.
       ////////////////////////////////////////////////////////////
       public this() {
           super(ID);
       }
}

private class InputComponent : ComponentDetail!InputComponent {
}

void main() {
       auto pComponent = new InputComponent();

       writeln(pComponent.getId());
       writeln(InputComponent.ID);
}


More information about the Digitalmars-d-learn mailing list