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.

>
>  .../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
>
>

Reply via email to