https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98001

--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 26 Nov 2020, redi at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98001
> 
> Jonathan Wakely <redi at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>            Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot 
> gnu.org
>              Status|NEW                         |ASSIGNED
> 
> --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> I don't think we actually need fflush(__file) to set errno in order to verify
> that the library doesn't set it to zero.
> 
> So this should be fine:
> 
> --- a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
> +++ b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
> @@ -26,10 +26,10 @@ void
>  test01()
>  {
>    FILE* f = std::fopen("79820.txt", "w");
> -  std::fclose(f);
>    errno = 127;
>    __gnu_cxx::stdio_filebuf<char> b(f, std::ios::out, BUFSIZ);
>    VERIFY(errno == 127); // PR libstdc++/79820
> +  std::fclose(f);
>  }

Is the DTOR of stdio_filebuf fine with the file being closed
under it?  For a fix in our GCC 7 tree I wrapped it in
its own scope to ensure the DTOR is called before fclose

>  int
> 
>

Reply via email to