[cfe-dev] Parser Stmt/Expr Owning Pointer

Howard Hinnant hhinnant at apple.com
Tue Dec 9 11:32:10 PST 2008


I haven't traced this down exactly, so I'm not sure there's a  
problem.  But in:

   template <void (Action::*Destroyer)(void*)>
   class ASTMove {
     ASTOwner<Destroyer> &Moved;

   public:
     explicit ASTMove(ASTOwner<Destroyer> &moved) : Moved(moved) {}
     ...

we store a reference to the ASTOwner.  And I also see client code that  
looks like:

     ExprOwner Idx(Actions, ParseAssignmentExpression());
     if (Idx.isInvalid()) {
       SkipUntil(tok::r_square);
       return Idx.move();
     }

Are we in danger of returning a reference to the local variable Idx?

-Howard




More information about the cfe-dev mailing list