On Fri, 27 Feb 2026, 22:23 Tomasz Kaminski, <[email protected]> wrote:
> > On Fri, Feb 27, 2026 at 11:05 PM Tomasz Kamiński <[email protected]> > wrote: > >> libstdc++ PR/105580 >> >> libstdc++-v3/ChangeLog: >> >> * testsuite/24_iterators/istreambuf_iterator/105580.cc: New test. >> --- >> Pushing a test checking for warning as separate commit, as it make it >> easier for me to reliably detect if fix works. >> >> Tested the new file with all standard modes. OK for trunk? >> > I turns out that the warning is not emitted for _GLIBCXX_DEBUG, and making > it > conditionally unsupported if !debug, is not worth extra complexity. > Especially when > warnings will be not-emitted after fix-up commit. > I think you can just add: { dg-require-normal-mode "" } But I agree it's not needed, most people won't get it with debug mode enabled and it will stop warning later anyway. I didn't mean that a test to detect the warning needs to be added separately. It would be fine to just push the test in the same commit with the fix, as long as you've verified locally that it failed before the fix. But it's ok this way too. OK for trunk >> .../24_iterators/istreambuf_iterator/105580.cc | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >> create mode 100644 >> libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/105580.cc >> >> diff --git >> a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/105580.cc >> b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/105580.cc >> new file mode 100644 >> index 00000000000..7c70b8237c3 >> --- /dev/null >> +++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/105580.cc >> @@ -0,0 +1,15 @@ >> +// { dg-compile } >> +// { dg-additional-options "-Wnull-dereference" } >> + >> +#include <string> >> +#include <sstream> >> + >> +int main() >> +{ >> + std::istringstream in{"Hello, world"}; >> + std::istreambuf_iterator<char> it(in), end; >> + std::string ss{it, end}; >> + return 0; >> +} >> +// { dg-warning ".*null pointer dereference" "" { target *-*-* } 0 } >> + >> -- >> 2.53.0 >> >>
