From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30182 invoked by alias); 31 Oct 2017 10:01:00 -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 29804 invoked by uid 89); 31 Oct 2017 10:00:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-ms-exchange-transport-fromentityheader:Hosted, mingw64-g, D*st.com, mingw64g X-HELO: mx07-00178001.pphosted.com Received: from mx07-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (62.209.51.94) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Oct 2017 10:00:56 +0000 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9V9wu4n011297 for ; Tue, 31 Oct 2017 11:00:54 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2dvfnqkm38-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 31 Oct 2017 11:00:54 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7B64631 for ; Tue, 31 Oct 2017 10:00:51 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node1.st.com [10.75.127.13]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3CCC61DF8 for ; Tue, 31 Oct 2017 10:00:51 +0000 (GMT) Received: from SFHDAG5NODE3.st.com (10.75.127.15) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 31 Oct 2017 11:00:50 +0100 Received: from SFHDAG5NODE3.st.com ([fe80::7c09:5d6b:d2c7:5f47]) by SFHDAG5NODE3.st.com ([fe80::7c09:5d6b:d2c7:5f47%20]) with mapi id 15.00.1347.000; Tue, 31 Oct 2017 11:00:50 +0100 From: Paolo ZAMBOTTI To: "cygwin@cygwin.com" Subject: Re: cygwin x86_64: mingw64-g++ 6.4.0 (both i686 and x86_64) issue (bug?) with reinterpret_cast Date: Tue, 31 Oct 2017 10:01:00 -0000 Message-ID: <515e5221f28f4df880916eaa1b25b7aa@SFHDAG5NODE3.st.com> x-ms-exchange-transport-fromentityheader: Hosted Content-Type: multipart/mixed; boundary="_002_515e5221f28f4df880916eaa1b25b7aaSFHDAG5NODE3stcom_" MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-31_03:,, signatures=0 X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00380.txt.bz2 --_002_515e5221f28f4df880916eaa1b25b7aaSFHDAG5NODE3stcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-length: 5187 Hi Csaba, Ok, then the issue are "my" lines of code and the error messages from g++ w= ere not completely clear (and they was confusing me a little bit)... But I'm still not sure the issue is not in Cygwin package. I mean, my test = code was a very simplified (too much simplified) excerpt from squid source = code and, there, the link with header file from cygwin package is more clea= r. Then, let me post another test file where this link is more clear. Now the failure is as follow (g++ -std=3Dgnu++11 -c -Wall -pedantic -Wextra= test.cpp) In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/winbase.= h:19:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.= h:70, from test.cpp:1: test.cpp:6:45: error: reinterpret_cast from integer to pointer static constexpr HANDLE InvalidHandle =3D INVALID_HANDLE_VALUE; ^ The issue is now within the macro definition of INVALID_HANDLE_VALUE in fil= e handleapi.h (which could be, from i686-w64-mingw32, x86_64-w64-mingw32 or= w32api) Now I'm wondering what is really wrong: does the definition of INVALID_HANDLE_VALUE need to be rewritten in order = to be compatible with the "static constexpr" line or does "my" line of code has to be rewritten in order to be compatible with = the INVALID_HANDLE_VALUE definition? In the latest case, any suggestion will be very welcome... Paolo. > Hi Paolo, >=20 > On Mon, Oct 23, 2017 at 4:47 PM, Paolo ZAMBOTTI w= rote: > > Hello, > > > > I'm having some issues while compiling C++ code with mingw64 c++ compil= er (6.4.0) distributed within Cygwin packages. > > I can guess the issue I'm going to report is not strictly related to Cy= gwin distribution but I cannot test other mingw64 distributions so let me s= tart reporting the issue here... > > Once said that, I'm open to any suggestions for better reporting place.= .. > > > > I'm not an expert in C and even less in C++ so I hope to not generate s= tupid noise... but the same code was compiling fine with previous version (= 5.4) ... >=20 > Note that compilers tend to become more picky with time. The fact that > this code was compiling fine with GCC 5.4 may well be a bug in GCC 5.4 >=20 > $ gcc-630 -std=3Dgnu++11 -c -Wall -pedantic -Wextra fail.cpp > fail.cpp: In function 'int main(int, char**)': > fail.cpp:10:34: error: reinterpret_cast from integer to pointer > static constexpr void* test1 =3D (void*)(-1LL); > ^~~~~~~~~~~~~ > fail.cpp:11:34: error: reinterpret_cast from integer to pointer > static constexpr void* test2 =3D (void*)(-1L); > ^~~~~~~~~~~~ >=20 > $ gcc-7 -std=3Dgnu++11 -c -Wall -pedantic -Wextra fail.cpp > gcc-7 gcc-710 > csabaraduly@HU-GD-36813:/tmp > $ gcc-7 -std=3Dgnu++11 -c -Wall -pedantic -Wextra fail.cpp > fail.cpp: In function 'int main(int, char**)': > fail.cpp:10:34: error: 'reinterpret_cast(-1)' is not a constant > expression > static constexpr void* test1 =3D (void*)(-1LL); > ^~~~~~~~~~~~~ > fail.cpp:11:34: error: 'reinterpret_cast(-1)' is not a constant > expression > static constexpr void* test2 =3D (void*)(-1L); > ^~~~~~~~~~~~ >=20 > $ gcc-8 -std=3Dgnu++11 -c -Wall -pedantic -Wextra fail.cpp > fail.cpp: In function 'int main(int, char**)': > fail.cpp:10:34: error: reinterpret_cast from integer to pointer > static constexpr void* test1 =3D (void*)(-1LL); > ^~~~~~~~~~~~~ > fail.cpp:11:34: error: reinterpret_cast from integer to pointer > static constexpr void* test2 =3D (void*)(-1L); > ^~~~~~~~~~~~ >=20 > $ clang++ -std=3Dgnu++11 -c -Wall -pedantic -Wextra fail.cpp > fail.cpp:10:26: error: constexpr variable 'test1' must be initialized > by a constant expression > static constexpr void* test1 =3D (void*)(-1LL); > ^ ~~~~~~~~~~~~~ > fail.cpp:10:34: note: cast that performs the conversions of a > reinterpret_cast is not allowed in a constant expression > static constexpr void* test1 =3D (void*)(-1LL); > ^ > fail.cpp:11:26: error: constexpr variable 'test2' must be initialized > by a constant expression > static constexpr void* test2 =3D (void*)(-1L); > ^ ~~~~~~~~~~~~ > fail.cpp:11:34: note: cast that performs the conversions of a > reinterpret_cast is not allowed in a constant expression > static constexpr void* test2 =3D (void*)(-1L); > ^ >=20 > I think clang explains it best. > Note: these were Linux compilers, but your question is not > Cygwin-specific (and including windows.h is unnecessary). >=20 > Csaba > --=20 > GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++ > The Tao of math: The numbers you can count are not the real numbers. > Life is complex, with real and imaginary parts. > "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus To= rvalds > "People disagree with me. I just ignore them." -- Linus Torvalds --_002_515e5221f28f4df880916eaa1b25b7aaSFHDAG5NODE3stcom_ Content-Type: text/plain; name="test.cpp" Content-Description: test.cpp Content-Disposition: attachment; filename="test.cpp"; size=389; creation-date="Mon, 23 Oct 2017 12:36:49 GMT"; modification-date="Tue, 31 Oct 2017 09:28:33 GMT" Content-Transfer-Encoding: base64 Content-length: 529 I2luY2x1ZGUgPHdpbmRvd3MuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CgpjbGFz cyB0ZXN0IHsKICBwcml2YXRlOgogICAgc3RhdGljIGNvbnN0ZXhwciBIQU5E TEUgSW52YWxpZEhhbmRsZSA9IElOVkFMSURfSEFORExFX1ZBTFVFOwogICAg CiAgcHVibGljOgogICAgSEFORExFIGdldF9JbnZIYWhuZGxlKHZvaWQpIHsK ICAgICAgcmV0dXJuIEludmFsaWRIYW5kbGU7CiAgICB9Cn07CiAgCgppbnQg bWFpbiAoX19hdHRyaWJ1dGVfXygodW51c2VkKSkgaW50IGFyZ2MsIF9fYXR0 cmlidXRlX18oKHVudXNlZCkpIGNoYXIgKiphcmd2KSB7CiAgdGVzdCBmYWls OwogIAogIHByaW50ZigiJWxseFxuIiwgKGxvbmcgbG9uZykoZmFpbC5nZXRf SW52SGFobmRsZSgpKSk7CgpyZXR1cm4gMDsKCn0= --_002_515e5221f28f4df880916eaa1b25b7aaSFHDAG5NODE3stcom_ Content-Type: text/plain; charset=us-ascii Content-length: 219 -- 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 --_002_515e5221f28f4df880916eaa1b25b7aaSFHDAG5NODE3stcom_--