Another day another bug .. :)

~/felix>flx --test=build/release -c --static lt
./lt.cpp: In function ‘void _rev(void**)’:
./lt.cpp:28: error: redefinition of ‘void _rev(void**)’
compilation terminated due to -Wfatal-errors.

list.flx

  // in place list reversal: unsafe!
  proc rev[T,PLT=&list[T]] : &list[T] = "_rev($1);" requires _iprev_[T,PLT];

  body _iprev_[T,PLT]=
    """
    void _rev(?2 plt)
    { // in place reversal
      struct node_t { ?1 elt; void *tail; };
      void *nutail = 0; 
      void *cur = *plt;
      while(cur)
      {
        void *oldtail = ((node_t*)FLX_VP(cur))->tail;   // save old tail in temp
        ((node_t*)FLX_VP(cur))->tail = nutail;          // overwrite current 
node tail
        nutail = cur;                                   // set new tail to 
current
        cur = oldtail;                                  // set current to saved 
old tail
      }
      *plt = nutail;                                    // overwrite 
    }
    """
  ;

generated code giving error:
//-----------------------------------------
//EMIT USER BODY CODE

    void _rev(_poly_5493t_29757* plt)
    { // in place reversal
      struct node_t { _poly_4927t_29756 elt; void *tail; };
      void *nutail = 0;
      void *cur = *plt;
      while(cur)
      {
        void *oldtail = ((node_t*)FLX_VP(cur))->tail;   // save old tail in temp
        ((node_t*)FLX_VP(cur))->tail = nutail;          // overwrite current 
node tail
        nutail = cur;                                   // set new tail to 
current
        cur = oldtail;                                  // set current to saved 
old tail
      }
      *plt = nutail;                                    // overwrite
    }
    

    void _rev(_poly_5493t_29764* plt)
    { // in place reversal
      struct node_t { _a4974t_29738* elt; void *tail; };
      void *nutail = 0;
      void *cur = *plt;
      while(cur)
      {
        void *oldtail = ((node_t*)FLX_VP(cur))->tail;   // save old tail in temp
        ((node_t*)FLX_VP(cur))->tail = nutail;          // overwrite current 
node tail
        nutail = cur;                                   // set new tail to 
current
        cur = oldtail;                                  // set current to saved 
old tail
      }
      *plt = nutail;                                    // overwrite
    }
    
because although the two type names are different they're typedefs
for the same C type...

--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to