From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12992 invoked by alias); 10 Jun 2019 04:38:10 -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 12985 invoked by uid 89); 10 Jun 2019 04:38:10 -0000 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 Received: from mail-ed1-f47.google.com (HELO mail-ed1-f47.google.com) (209.85.208.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Jun 2019 04:38:08 +0000 Received: by mail-ed1-f47.google.com with SMTP id k8so11382104eds.7 for ; Sun, 09 Jun 2019 21:38:07 -0700 (PDT) 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 Date: Mon, 10 Jun 2019 04:38:00 -0000 Message-ID: Subject: g++ doesn't diagnose implicit int error To: cygwin@cygwin.com Cc: Keith Thompson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-06/txt/msg00113.txt.bz2 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: =3D=3D=3D CUT HERE =3D=3D=3D #!/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 =E2=80=98ptr=E2= =80=99 with no type [-fpermissive]" verbosely g++ -c -fpermissive implicit_int.cpp echo ">>> EXPECTED: error: ISO C++ forbids declaration of =E2=80=98notype= =E2=80=99 with no type [-fpermissive]" verbosely g++ -c implicit_int.cpp echo ">>> EXPECTED: error: ISO C++ forbids declaration of =E2=80=98notype= =E2=80=99 with no type [-fpermissive]" verbosely g++ -c -std=3Dc++11 -pedantic implicit_int.cpp =3D=3D=3D AND HERE =3D=3D=3D The output under 64-bit Cygwin on Windows 10. This demonstrates the problem. =3D=3D=3D CUT HERE =3D=3D=3D % 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 =E2=80=98ptr=E2=80=99= with no type [-fpermissive] % g++ -c -fpermissive implicit_int.cpp >>> EXPECTED: error: ISO C++ forbids declaration of =E2=80=98notype=E2=80= =99 with no type [-fpermissive] % g++ -c implicit_int.cpp >>> EXPECTED: error: ISO C++ forbids declaration of =E2=80=98notype=E2=80= =99 with no type [-fpermissive] % g++ -c -std=3Dc++11 -pedantic implicit_int.cpp =3D=3D=3D AND HERE =3D=3D=3D Output of the same script (note the same version of g++) on Ubuntu 18.04. This does NOT demonstrate the problem. =3D=3D=3D CUT HERE =3D=3D=3D % 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 =E2=80=98ptr=E2=80=99= with no type [-fpermissive] % g++ -c -fpermissive implicit_int.cpp implicit_int.cpp:1:6: warning: ISO C++ forbids declaration of =E2=80=98func= =E2=80=99 with no type [-fpermissive] func() { } ^ >>> EXPECTED: error: ISO C++ forbids declaration of =E2=80=98notype=E2=80= =99 with no type [-fpermissive] % g++ -c implicit_int.cpp implicit_int.cpp:1:6: error: ISO C++ forbids declaration of =E2=80=98func= =E2=80=99 with no type [-fpermissive] func() { } ^ >>> exit 1 >>> EXPECTED: error: ISO C++ forbids declaration of =E2=80=98notype=E2=80= =99 with no type [-fpermissive] % g++ -c -std=3Dc++11 -pedantic implicit_int.cpp implicit_int.cpp:1:6: error: ISO C++ forbids declaration of =E2=80=98func= =E2=80=99 with no type [-fpermissive] func() { } ^ >>> exit 1 =3D=3D=3D AND HERE =3D=3D=3D 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