From: Keith Thompson <Keith.S.Thompson@gmail.com>
To: cygwin@cygwin.com
Cc: Keith Thompson <Keith.S.Thompson@gmail.com>
Subject: g++ doesn't diagnose implicit int error
Date: Mon, 10 Jun 2019 04:38:00 -0000 [thread overview]
Message-ID: <CAAHpriO62Lhm9-eGrmA17gFZNFGLEeUrAmeKE+yNvhvBjFgRAA@mail.gmail.com> (raw)
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
next reply other threads:[~2019-06-10 4:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 4:38 Keith Thompson [this message]
2019-06-11 7:48 ` Keith Thompson
2019-06-11 17:22 ` Achim Gratz
2019-06-11 18:35 ` Brian Inglis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAHpriO62Lhm9-eGrmA17gFZNFGLEeUrAmeKE+yNvhvBjFgRAA@mail.gmail.com \
--to=keith.s.thompson@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).