From 0f8e0251f412f82fe3217f3a301ba0f3574aea12 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 4 Feb 2011 22:53:22 -0500 Subject: Fixed a bug preventing g++ 4.6 from working --- src/system.hh.in | 2 +- src/token.cc | 7 +++++++ src/utils.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/system.hh.in b/src/system.hh.in index d5b14bdb..c1cc8e30 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -149,7 +149,7 @@ typedef std::ostream::pos_type ostream_pos_type; #include #include #include -#if !(__cplusplus > 199711) +#if !(defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__) #include #endif #include diff --git a/src/token.cc b/src/token.cc index 64a5e9f9..7bfaf162 100644 --- a/src/token.cc +++ b/src/token.cc @@ -439,6 +439,13 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags, unexpected(expecting); } } else { + if (! in.good()) { + in.clear(); + in.seekg(0, std::ios::end); + if (in.fail()) + throw_(parse_error, _("Failed to reset input stream")); + } + kind = VALUE; value = temp; length = static_cast(in.tellg() - pos); diff --git a/src/utils.h b/src/utils.h index 44ee2c02..af75514c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -523,7 +523,7 @@ inline void check_for_signal() { */ /*@{*/ -#if (__cplusplus > 199711) +#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__ #define foreach(x, y) for (x : y) #define unique_ptr std::unique_ptr #else -- cgit v1.2.3