Weird error when compiling.

Agustin agustin.l.alvarez at hotmail.com
Sun Oct 20 17:32:39 PDT 2013


On Monday, 21 October 2013 at 00:13:59 UTC, bearophile wrote:
> Agustin:
>
>> Sorry i clicked the post button :(. The full code is:
>
> I don't see your error with the following code, please give the 
> code that gives the error, so we can fix the compiler bug:
>
>
> public class Component {
>       
> ////////////////////////////////////////////////////////////
>       /// Component's unique id.
>       private hash_t id;
>       ....Assertion failure: 'thisval && thisval->op ==
TOKclassreference' on line 4067 in file 'interpret.c' when
compiling this.
>       
> ////////////////////////////////////////////////////////////
>       /// \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);
> }
>
>
>
> Bye,
> bearophile

The code is: http://pastebin.com/510YK2Se
Using (LDC 0.12.0-beta 1 Ubuntu): http://pastebin.com/2gAWnYyr
Using (DMD Windows): Assertion failure: 'thisval && thisval->op ==
TOKclassreference' on line 4067 in file 'interpret.c' when
compiling this.


More information about the Digitalmars-d-learn mailing list