DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 45EFbpOI713521 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=xSjXY7qi X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 780E13882100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1718379470; bh=PoEL/l662i39CSeTtyu9zfDF/8pkSWWSa/4Q+7vuI2o=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=xSjXY7qioH1sFDVvOgmIDPMx1zANTQUzLGMZx+Q+wJRi0Mh1GdyhPmpeG3B3NxmAq v/AWjkTc8209gohnVE/ZOq3+E6RMByCrXKYhBlXwIt5OkZBNjTDLZ846h9p35K3BeX 1ujYPGMZsgzDfsirsBdimcqJ+rkXAmQ70bgKqWr4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4C375388264F ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4C375388264F ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718379448; cv=none; b=YRzXPdo11+OQF/ssFNQogm18RXYE2aMdkAbKkPD97fg0v0nEXd2kFt+QUrI5osEL460m4RgLCTCApYvXhWsMUJJZuA5yQTZG+D9Z/qJ5ffqrjTlvEnJOd8DVNXQ2zvfsZVHWkgBndpKyQSD6ey7XTiRxFO+iaNx3H3P5PNaRw+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718379448; c=relaxed/simple; bh=1h8abB0mvrsYe+fBVTD5ZcksrPWksk8NfiaV7BJZnN0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=wUuLQoda9cAEcNdLUQJ+3JLZeDi4fE69ptxeE0dPRu9chVA3h7AtnALf9hkk9GqJk7ji67OwjiBiN1xKwrJkPJNVu6vJOWPWPk6N17gDjkktzpjRNtEskWYN81g8k64CJ0PsE0FlUSLsfruIAsZQtmvq4uyDyRdavRGztk4zNng= ARC-Authentication-Results: i=1; server2.sourceware.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718379445; x=1718984245; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2CJ1R8jrKVv42gyPtuXQG5tr2wdXxmJGT5nBm0DweXk=; b=X4FhcexB9ZKyWHhHIAhNb/Hm2UqrYJAYhpuJBQIeHfrSvax2Zsg1aZaF7bNqpns001 O0K7jU6GSypeRnczdgt/NeBfelbHRM2v27kHRIjxCJLG1T2EIOiSt9Fnr0M5eVm3MdwD MdQN+LF6GE7WgjhZH2U+BEvBaSpEF53IMSW5YkWVtaFuYpgm8eUTWe5bquYtatVMmz3a kybT5NZTn1jKyyKP+yZGQzuK2hP9Ty8o5dpCjZ7vYXJ3+u51OLTxJUi9ZnyCw2aZovQv XPbSQErFUORpXtUjH+NBsSFq9cHQuOKx8t+OxKEEJD4kIaveiIxK3VwNt1Mpio7SxC/j 7oDA== X-Gm-Message-State: AOJu0Yw2jk5zCylnvYMg0blq1eMNjwG4tbrph6T/YLo1hIY+yUPsW3d5 N0jJesWGiiT/yr50j3rDqDjQVeRtnck6u8VhRbYAbtpOu0XuJuu1oeeIEgRR5MRCxs3Mp6QXwAU brZIQpxvpKmy5xFxq0SlFshBqNGl+KNlL X-Google-Smtp-Source: AGHT+IGIN54HYSLmFXc043yFSz0ZMetfWc5T2AslhN9pvgKqu9Zdx0Yr7DXooQWNS7Cl4NBOCR0B5LVXnG6FqdCQY6g= X-Received: by 2002:a17:90a:a097:b0:2c1:e54a:19b9 with SMTP id 98e67ed59e1d1-2c4db44c861mr3233169a91.21.1718379444907; Fri, 14 Jun 2024 08:37:24 -0700 (PDT) MIME-Version: 1.0 Date: Fri, 14 Jun 2024 17:37:13 +0200 Message-ID: Subject: Bug in GCC / libstdc++: Space character categorized as non-printable by std::ctype To: cygwin AT cygwin DOT com X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.30 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Kristian Spangsege via Cygwin Reply-To: Kristian Spangsege Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" In C++, a space character is reported as non-printable by `std::ctype` in the "C" locale (the only locale supported by `std::ctype`). In other words, the following expression evaluates to `false`: ctype.is(std::ctype_base::print, ctype.widen(' ')) where `ctype` is obtained by `std::use_facet>(loc)` and `loc` is the "C" locale. It should have been evaluated to `true` because a space character is required by the C++ standard to be categorized as printable. Also, it is reported as printable by `std::iswprint(int ch)`. Also, the non-wide space character is reported as printable, i.e, `std::use_facet>(loc)::is(std::ctype_base::print, ' ')` is `true`. Also, `ctype.is(std::ctype_base::print, ctype.widen(' '))` is `true` with MinGW, with GCC on Linux, and with Visual Studio. The problem can be demonstrated with the code below in regular Cygwin ( https://cygwin.com/install.html) using GCC 12.3.1 and in the Cygwin environment of MSYS2 (https://www.msys2.org/) using GCC 13.2.0: #include #include #include #include int main() { using facet_type = std::ctype; std::locale loc; const auto& ctype = std::use_facet(loc); wchar_t ch = ctype.widen(' '); std::cout << ctype.is(ctype.print, ch) << "\n"; std::cout << (std::iswprint(std::char_traits::to_int_type(ch)) != 0) << "\n"; } Regards Kristian Spangsege -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple