Oh I see now.  std::stringstream buf is declared twice, once at 1976 and again inside another if block at 1978.  The second one can be removed and it should still work just fine.