From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75851 invoked by alias); 12 Jun 2018 20:32:27 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 75737 invoked by uid 89); 12 Jun 2018 20:32:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*r:Unknown, you!, HContent-Transfer-Encoding:8bit X-HELO: blaine.gmane.org Received: from Unknown (HELO blaine.gmane.org) (195.159.176.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Jun 2018 20:32:25 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fSpve-0004OQ-TS for cygwin@cygwin.com; Tue, 12 Jun 2018 22:30:10 +0200 To: cygwin@cygwin.com From: Ross Smith Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream Date: Wed, 13 Jun 2018 03:05:00 -0000 Message-ID: <25a7729c-7d4c-ee3a-6656-4f6d6932a164@otoy.com> References: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 In-Reply-To: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de> X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00132.txt.bz2 Message-ID: <20180613030500.JjdvnkIjJapvoJLAD3fVx5CKPQmpzK-rUfGP12AN1bA@z> On 2018-06-13 05:11, Christian Franke wrote: > Ivan Shynkarenka wrote: >> I use x64 bit Cygwin and it failed in my home, work and Appveyor.  I add >> cygcheck.out with my environment. >> >> I'm sorry about misspell prefix space in my prev example. Please try the >> following one: >> >> #include >> #include >> >> int main(int argc, char** argv) >> { >>      std::string line; >>      std::ifstream stream("test.cpp"); >>      while (getline(stream, line)) >>          std::cout << line << std::endl; >>      return 0; >> } >> >> g++ -std=gnu++17 test.cpp > > 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 Thank you! I can confirm that the patch fixes this. Ross Smith -- 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