X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:references :mime-version:content-type:content-transfer-encoding :in-reply-to; q=dns; s=default; b=gwAreWsyefJUcbId0RmjLW/W5J0xlz g5Pe0OTdRCVFHQqU03RZawb6mfs9P1MgVMzNC6vaLAJ0lQNrm0IhQUugcm6BWbkm yQoUJlKRpSKXJw8xYY6Oqh5wipQgcooHkv/qgr3doKTD05dsCmnFHmcdyHaf1IaQ vgxnqEUIEvATI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:references :mime-version:content-type:content-transfer-encoding :in-reply-to; s=default; bh=KwKjaoLa33Braf43oLdGFDTZJso=; b=dWaA /RAvW1vimhXa/QT89WPHzM46X+SJedg1AdhRk5CkupRWA4LyTWcafhSQWdYRvxhv IcKdnQ0OKMrZ5R+1Pt+snAHD5z/XsT4puhr/BPWtNS6PAzGF84Q9856jRqos/vNV /jojv7MhyUQmQQDhRJu/rC6R4smIrdwrcKcxkjg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 To: cygwin AT cygwin DOT com From: Ross Smith Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream Date: Wed, 13 Jun 2018 08:32:17 +1200 Lines: 53 Message-ID: <25a7729c-7d4c-ee3a-6656-4f6d6932a164@otoy.com> References: <0725bdbd-0411-138a-7ea9-d6395e3256e3 AT t-online DOT 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 Note-from-DJ: This may be spam 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