libstdc++: Add test for -Wnull-deference in istream_iterator [PR105580]

PR libstdc++/105580

libstdc++-v3/ChangeLog:

	* testsuite/24_iterators/istreambuf_iterator/105580.cc: New test.
This commit is contained in:
Tomasz Kamiński
2026-02-27 19:55:19 +01:00
parent 5d12019d75
commit 8758503918

View File

@@ -0,0 +1,16 @@
// { dg-compile }
// { dg-require-normal-mode "" }
// { 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 }