------- Comment #5 from sebor at roguewave dot com 2006-09-12 00:16 ------- The reason why I think library issue 309 may be relevant is because while the arithmetic extraction operator>>() is a formatted input function (and thus subject to 27.6.1.1, p4, and required to begin by constructing a sentry object), the sentry ctor is neither a formatted nor unformatted input function, and thus could be considered exempt from the requirements imposed by 27.6.1.1, p4 on the two groups of input functions. The sentry ctor need not even call sgetc() or sbumpc() (e.g., it could call underflow() directly).
Further, since the description of the extraction operators clearly separates the initial construction of the sentry from subsequently "obtaining the requested input," an exception thrown during the construction of the sentry could be considered as having occurred prior to "obtaining the requested input" and thus be allowed, in fact required, to propagate to the caller. Note that the impact of the issue isn't just on the extraction operators defined by the library, it affects user-defined extraction operators as well, specifically those that make use of the sentry and that aim to conform to the general iostream exception safety requirements. My "additional comments" on the issue explain how and why. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29026