Index: lib/Format/Format.cpp =================================================================== --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -676,6 +676,12 @@ typedef std::priority_queue, std::greater > QueueType; + struct Compare { + bool operator()(LineState *obj1, LineState *obj2) const { + return *obj1 < *obj2; + } + }; + /// \brief Analyze the entire solution space starting from \p InitialState. /// /// This implements a variant of Dijkstra's algorithm on the graph that spans @@ -683,7 +689,7 @@ /// find the shortest path (the one with lowest penalty) from \p InitialState /// to a state where all tokens are placed. unsigned analyzeSolutionSpace(LineState &InitialState) { - std::set Seen; + std::set Seen; // Insert start element into queue. StateNode *Node = @@ -701,7 +707,7 @@ } Queue.pop(); - if (!Seen.insert(Node->State).second) + if (!Seen.insert(&Node->State).second) // State already examined with lower penalty. continue;