public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57709] New: -Wshadow is too strict / has false positives
@ 2013-06-25 13:52 jan.kratochvil at redhat dot com
  2013-06-25 15:52 ` [Bug c++/57709] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-06-25 13:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57709

            Bug ID: 57709
           Summary: -Wshadow is too strict / has false positives
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
            Target: x86_64-unknown-linux-gnu

class C {
  int both_var;
  void var_and_method() {}
  void m() { int both_var, var_and_method; }
};

FAIL: gcc (GCC) 4.8.2 20130625 (prerelease)
FAIL: gcc (GCC) 4.9.0 20130625 (experimental)
g++ -c -o shadow.o shadow.C -Wshadow -Wno-unused
shadow.C:4:18: warning: declaration of ‘both_var’ shadows a member of 'this'
[-Wshadow]
shadow.C:4:28: warning: declaration of ‘var_and_method’ shadows a member of
'this' [-Wshadow]

clang-3.3-0.4.rc2.fc18.x86_64
clang -c -o shadow.o shadow.C -Wshadow -Wno-unused
shadow.C:4:18: warning: declaration shadows a field of 'C' [-Wshadow]
  void m() { int both_var, var_and_method; }
                 ^
shadow.C:2:7: note: previous declaration is here
  int both_var;
      ^
1 warning generated.

------------------------------------------------------------------------------

clang does no warn on "var_and_method" as variable vs. method are safe, if one
tries to use them inappropriately one gets an error.

It is difficult to enable -Wshadow for existing project as it has many needless
warnings, with clang it is easier and still safe.
>From gcc-bugs-return-425092-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 25 14:01:12 2013
Return-Path: <gcc-bugs-return-425092-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25074 invoked by alias); 25 Jun 2013 14:01:12 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 25045 invoked by uid 48); 25 Jun 2013 14:01:10 -0000
From: "schwab@linux-m68k.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57707] gcc misinterprets hex escapes in constant strings
Date: Tue, 25 Jun 2013 14:01:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.7.1
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: schwab@linux-m68k.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-57707-4-hz3sgmWPCE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57707-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57707-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-06/txt/msg01471.txt.bz2
Content-length: 465

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW707

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
6.4.4.4

Bugzilla is not the right place to learn C.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-06-09  9:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-25 13:52 [Bug c++/57709] New: -Wshadow is too strict / has false positives jan.kratochvil at redhat dot com
2013-06-25 15:52 ` [Bug c++/57709] " pinskia at gcc dot gnu.org
2013-06-25 16:17 ` jakub at gcc dot gnu.org
2013-06-25 16:40 ` jan.kratochvil at redhat dot com
2013-06-25 16:46 ` manu at gcc dot gnu.org
2013-06-25 18:00 ` manu at gcc dot gnu.org
2013-11-19  6:31 ` manu at gcc dot gnu.org
2013-11-19 13:40 ` jan.kratochvil at redhat dot com
2013-11-19 16:49 ` manu at gcc dot gnu.org
2013-11-19 17:15 ` jan.kratochvil at redhat dot com
2013-12-14  7:57 ` jan.kratochvil at redhat dot com
2013-12-17 22:35 ` joseph at codesourcery dot com
2014-08-22 19:13 ` manu at gcc dot gnu.org
2015-06-09  9:33 ` gael.guennebaud at gmail dot com
2015-06-09  9:47 ` manu at gcc dot gnu.org

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).