GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream

Marco Atzeri marco.atzeri@gmail.com
Wed Jun 13 08:49:00 GMT 2018


On 6/12/2018 7:11 PM, Christian Franke wrote:
> Ivan Shynkarenka wrote:
> Could reproduce this with 32 and 64 bit Cygwin g++ 7.3.0
> 
> A comparison of preprocessor (-E) outputs shows that the "extern 
> template" declarations for getline() are only visible for C++ <= 14. 
> These are guarded by "__cplusplus <= 1402" in basic_string.tcc. This 
> should tell the compiler to generate new code for getline() if C++17 is 
> enabled instead of calling the (now incompatible) function in 
> cygstdc++-6.dll.
> 
> A comparison of assembly (-S) outputs shows that this does not work: If 
> C++17 is enabled, the compiler correctly generates local code for 
> getline(istream &, string &) but this code calls an external 
> getline(istream &, string &, char). Then the linker generates a call to 
> this getline() in cygstdc++-6.dll.
> 
> This is because there is a bogus prototype specialization for 
> getline(istream &, string &, char) in basic_string.h but no 
> corresponding implementation in basic_string.tcc. This has apparently an 
> equivalent effect as 'extern template'.
> 
> The attached patch for
>    /usr/lib/gcc/*-pc-cygwin/7.3.0/include/c++/bits/basic_string.h
> fixes this.
> 
> Christian
> 

Thanks Christian
for the investigation.

It seems an upstream bug so could you report it there ?

There are several c++17  bugs around
https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=c%2B%2B17

that is probably the reason why gcc 7.x defaults to c++14

Regards
Marco




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list