[Bug libstdc++/29026] New: std::basic_istream<>::sentry() fails to catch when reading whitespace
27.6.1.1 P4 says that formatted input functions should set badbit if a call to fetch characters from the streambuf throws an exception. The implementation of this in bits/istream.tcc is done after the sentry is constructed. But the sentry's constructor may try to read whitespace, and it is not doing any exception handling, so ios_base::badbit is not getting set in this case. -- Summary: std::basic_istream<>::sentry() fails to catch when reading whitespace Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jimrees at itasoftware dot com GCC build triplet: x86_64-redhat-linux GCC host triplet: x86_64-redhat-linux GCC target triplet: x86_64-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29026
[Bug libstdc++/29026] std::basic_istream<>::sentry() fails to catch when reading whitespace
--- Comment #1 from jimrees at itasoftware dot com 2006-09-11 21:07 --- Created an attachment (id=12228) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12228&action=view) bug reproducer program bug reproducer, compile with g++ - any flags, but do not disable exceptions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29026
[Bug libstdc++/29026] std::basic_istream<>::sentry() fails to catch when reading whitespace
--- Comment #2 from jimrees at itasoftware dot com 2006-09-11 21:10 --- fyi, a "real world" example of how this comes up? Construct a std::ifstream using a pathname to a directory instead of a file. Under Linux and MacOS at least, the basic_filebuf code is happy to open such a pathname, but then will get EISDIR when it first tries to read, and will throw an exception. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29026
[Bug libstdc++/29026] std::basic_istream<>::sentry() fails to catch when reading whitespace
--- Comment #4 from jimrees at itasoftware dot com 2006-09-11 22:23 --- Sure, the issue sounds interesting, and the committee's resolution statement is definitely lame. Bug issue 309 seems to be more about what is _specified_ about sentry::sentry()'s behavior, and I don't necessarily care about that w.r.t. this bug. I care about 27.6.1.1 P4 (which makes no mention of sentry), and with the GNU C++ implementation. The fact that operator>>() happens to invoke sentry's constructor does not make an excuse. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29026
[Bug c++/21385] New: __extension__ lost inside template
Target: x86_64-suse-linux Configured with: ../gcc-4.0.0/configure --prefix=/ita3 --enable-languages=c,c++ --with-system- zlib --enable-__cxa_atexit x86_64-suse-linux : (reconfigured) ../gcc-4.0.0/configure --prefix=/ita3 --enable-languages=c,c++ --with-system-zlib --enable-__cxa_atexit --disable-checking x86_64- suse-linux Thread model: posix gcc version 4.0.0 template functions appear to erase the effect of the __extension__ keyword inside their definitions, causing "-ansi -pedantic" to produce an error instead of a warning. Compiling the following code with "-ansi -pedantic" produces an error for the line in the template function, but not the ordinary function. % g++ -c -ansi -pedantic foo.cpp foo.cpp: In function âint template_function(int) [with T = void]â: foo.cpp:15: instantiated from here foo.cpp:11: error: ISO C++ forbids variable-size array -- int ordinary_function(int dimension) { __extension__ int data[dimension]; return 0; } template int template_function(int dimension) { __extension__ int data[dimension]; return 0; } template int template_function(int); -- Summary: __extension__ lost inside template Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: minor Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jimrees at itasoftware dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: x86_64-suse-linux GCC host triplet: x86_64-suse-linux GCC target triplet: x86_64-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21385