| delorie.com/archives/browse.cgi | search |
| 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:mime-version:from:date:message-id:subject:to | |
| :cc:content-type:content-transfer-encoding; q=dns; s=default; b= | |
| ZxFUS/iHO/nWEUnaZymw4KYC3Z74ZwwRk90v/1JiE2QlioTwrRDcFLmzBzLhkeE9 | |
| 9EkMv/aNAqIyJzEuCnYngmrw6eTLtgyVPUM0HvuLvpDiUqsH0/c58V/TVWctjWgJ | |
| VuFMcR2V1+A7lGy4cgfdnAkhyxk7t67A5DRsDUOM104= | |
| 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:mime-version:from:date:message-id:subject:to | |
| :cc:content-type:content-transfer-encoding; s=default; bh=sTT1vG | |
| ayDNkWp+P3xt/YLMVMgcw=; b=aTdXgE+X1WLsUJhNo8c86NEuNO9FvZPFBNN/ay | |
| GFnGWqmN9bAN04FiKL30+hU+oVpOWEO1pfDqoW9+08CIYbdlFjO4n9uRA0yFKnRP | |
| leMGffZLg3g/82OT/7zB/g04VMweDnENBt7+9GoaTKkc7dT1Dkn2INGdUlJ5BHwp | |
| 8qGVs= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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-Spam-SWARE-Status: | No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HERE, pedantic, sk:i686w6, sk:i686-w6 |
| X-HELO: | mail-ed1-f47.google.com |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc :content-transfer-encoding; bh=+oqjvZYKQsBOEYQC1cOkOzPFBcEAO2767hQS21FnMl4=; b=vXkTKR3vqXH7o2GjmbThrVKrS2gjBk6rJNNuQFNdKnn8xvmRDzTytkQwFtyuYa5I4y W6KecIbmAHdgqMCnpLyp1RQXqgin53ZyFdTxS2KbBI97SHy4X8b9/TPGf8BHOXxhgpU7 aZRIAksi8bdU3DGHICUK4KIDbpvSmoBy22bXQAsZ3sip77Pr1eEjP7BarfjFSQtDUKlo VCJJLcymn5xWBLUBXq6pxBm7AylCcA/kDj715Z6doMDc6e39NiPa4Nap46pxSWV3mWO8 Y7A98iFfwtga4C4/vjFv8nfcvXirYtSPOugt1NK7P3kkP1ns9sB60NXgNrfBmeK0s9Dz R0ng== |
| MIME-Version: | 1.0 |
| From: | Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com> |
| Date: | Sun, 9 Jun 2019 21:37:52 -0700 |
| Message-ID: | <CAAHpriO62Lhm9-eGrmA17gFZNFGLEeUrAmeKE+yNvhvBjFgRAA@mail.gmail.com> |
| Subject: | g++ doesn't diagnose implicit int error |
| To: | cygwin AT cygwin DOT com |
| Cc: | Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com> |
| X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id x5A4ch6q014151 |
See https://stackoverflow.com/q/56519330/827263 posted by user Fureeish
g++ on Cygwin does not diagnose an implicit int error.
The same version of g++ on Ubuntu correctly diagnoses the error.
(I had initially thought that g++ was defaulting to "-fpermissive",
but that would change the fatal error to a warning. Instead, no
diagnostic message is being produced at all.)
This script "implicit_int_bug.sh" demonstrates the problem:
=== CUT HERE ===
#!/bin/sh
verbosely() {
echo "% $*"
"$@" || echo ">>> exit $?"
}
verbosely uname -a
verbosely g++ --version
echo 'func() { }' > implicit_int.cpp
verbosely cat implicit_int.cpp
echo ">>> EXPECTED: warning: ISO C++ forbids declaration of ‘ptr’ with
no type [-fpermissive]"
verbosely g++ -c -fpermissive implicit_int.cpp
echo ">>> EXPECTED: error: ISO C++ forbids declaration of ‘notype’
with no type [-fpermissive]"
verbosely g++ -c implicit_int.cpp
echo ">>> EXPECTED: error: ISO C++ forbids declaration of ‘notype’
with no type [-fpermissive]"
verbosely g++ -c -std=c++11 -pedantic implicit_int.cpp
=== AND HERE ===
The output under 64-bit Cygwin on Windows 10.
This demonstrates the problem.
=== CUT HERE ===
% uname -a
CYGWIN_NT-10.0 eddie 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin
% g++ --version
g++ (GCC) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% cat implicit_int.cpp
func() { }
>>> EXPECTED: warning: ISO C++ forbids declaration of ‘ptr’ with no type [-fpermissive]
% g++ -c -fpermissive implicit_int.cpp
>>> EXPECTED: error: ISO C++ forbids declaration of ‘notype’ with no type [-fpermissive]
% g++ -c implicit_int.cpp
>>> EXPECTED: error: ISO C++ forbids declaration of ‘notype’ with no type [-fpermissive]
% g++ -c -std=c++11 -pedantic implicit_int.cpp
=== AND HERE ===
Output of the same script (note the same version of g++) on Ubuntu 18.04.
This does NOT demonstrate the problem.
=== CUT HERE ===
% uname -a
Linux bomb20 4.15.0-50-generic #54-Ubuntu SMP Mon May 6 18:46:08 UTC
2019 x86_64 x86_64 x86_64 GNU/Linux
% g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% cat implicit_int.cpp
func() { }
>>> EXPECTED: warning: ISO C++ forbids declaration of ‘ptr’ with no type [-fpermissive]
% g++ -c -fpermissive implicit_int.cpp
implicit_int.cpp:1:6: warning: ISO C++ forbids declaration of ‘func’
with no type [-fpermissive]
func() { }
^
>>> EXPECTED: error: ISO C++ forbids declaration of ‘notype’ with no type [-fpermissive]
% g++ -c implicit_int.cpp
implicit_int.cpp:1:6: error: ISO C++ forbids declaration of ‘func’
with no type [-fpermissive]
func() { }
^
>>> exit 1
>>> EXPECTED: error: ISO C++ forbids declaration of ‘notype’ with no type [-fpermissive]
% g++ -c -std=c++11 -pedantic implicit_int.cpp
implicit_int.cpp:1:6: error: ISO C++ forbids declaration of ‘func’
with no type [-fpermissive]
func() { }
^
>>> exit 1
=== AND HERE ===
I see the same problem on Cygwin with i686-w64-mingw32-g++,
x86_64-pc-cygwin-g++, and x86_64-w64-mingw32-g++ (all version 7.4.0).
The Stack Overflow post refers to a similar problem with MinGW.
I've seen the same problem on MSYS2, g++ 7.4.0.
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |