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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=oUXj5bd7ayvLujWS KS6W0UwFu+bBtXs3ku7eyTIxQgKeOsXiwMCnVE2RWRTC4vkXWaBtSRvgxqDWCVlH klzzst2u6bZV6bY7LdRzg9gQvIn/Kb/4G+4+dYz9SkQN5wYB6WpUw5Ob6uT8+fql DYxonyoNLDy5Xf7WnrCm106zO24= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=zdPpG37xk1a3hs/M9IvwhU nycu4=; b=c+wC2UucFu64G+O9oVOwDw9rcbapBd2olPi+aGNb7FTJtR70tbGPmZ N8y3b/BnCKV0swkbCog4f5zsYZIrQztGWtJE+DyJttxUr5sTnENSfXaBmgq859Xv y22rvOCEyhvgWsWjWfNeB2CR72eUrcAWVfQTww1enXomZgTCAs+NY= 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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:r21-v6s, HX-HELO:sk:mail-pg, H*r:sk:mail-pg X-HELO: mail-pg0-f46.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:newsgroups:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TEkNr+0TqRNqbjAUSqzcLhNtFGMgwler7s5ftFBj0XY=; b=c0GTWC2k5GeLNP96OIg+0csTVeOZ6SU8BJyZXGbcD3SQtwyfuOuDP5CixYDwllx0pH xKZW7yccelpdPEtYj74kMFnNy/fI+YAlljGbnhVgkA4OxFpzV4gBSMKBxtajYn1lGV8s NUKzEcdY2CGH9cPXEiR3Vr5NlNM4bEYYL6JQC4FM027520D+15MVfdYeupyiu3bVIVFS h81Ot2ukX3rsJcYSe5W44MfOis1xLpTmcdeiUbDjuIPAdJz4kGJrUajXiiBYEPk/uFXj KkoPZGL7GIzwSBKphZeqDZl32QxDl9ApEpGc2XQnKOs40DR2HTm6swmhiCcf4HYGUvRY hnBg== X-Gm-Message-State: APt69E0r95ZTJKWmTgPZ/cZk0fQo7zRfa1WZgU7q6zCKlQNM4rFQsBNO CQE0Pm/EFi241/QeSSpk2gynEVA= X-Google-Smtp-Source: ADUXVKIXycApSqhluLR4KZ8tDFDDj6diKV6Tw097Qsm4tJG5+q9eXXvEYHPNUef8RXtdYoSd52BBSg== X-Received: by 2002:a63:3e83:: with SMTP id l125-v6mr1602213pga.355.1528835541532; Tue, 12 Jun 2018 13:32:21 -0700 (PDT) Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream To: cygwin AT cygwin DOT com Newsgroups: gmane.os.cygwin References: <0725bdbd-0411-138a-7ea9-d6395e3256e3 AT t-online DOT de> From: Ross Smith Message-ID: <25a7729c-7d4c-ee3a-6656-4f6d6932a164@otoy.com> Date: Wed, 13 Jun 2018 08:32:17 +1200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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