🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50970

Re: Suppressing specific Warning Errors

#50970
From: Fergus James HENDERSON
Date: Fri, 16 Jul 1993 12:06
28 lines
1746 bytes
iwelch@agsm.ucla.edu (Ivo Welch) writes:

>Is it possible to selectively suppress just one warning in gcc? I have
>a class for  which I want to  define an interface  with functions that
>are identical to the variable names, e.g.,
>
>	class someclass {
>	 protected: int thisvar;
>	 public: thisvar() { return thisvar; }
>	}
>
>and I get tons of
>	warning: shadowing member `ex' with member function
>
>I am aware that   I could change  the name  of the members,  but would
>rather not.

Well, I would very strongly suggest that you do, because what you
are witnessing is actually a g++ bug - it should be an error, not a warning.
It is not legal to declare both a variable and a function with the same
name in the same scope. Other C++ compilers will correctly diagnose
this error.

-- 
Fergus Henderson                     This .signature virus might be
fjh@munta.cs.mu.OZ.AU                getting old, but you still can't
                                     consistently believe it unless you
Linux: Choice of a GNU Generation    copy it to your own .signature file!
Technical Details
Message-ID: <9319722.18713@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!noc.near.net!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
References: <21v4ob$ihr@news.mic.ucla.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,43659a2937a3250e
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-07-16 05:08:48 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!noc.near.net!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: Suppressing specific Warning Errors
Message-ID: <9319722.18713@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
References: <21v4ob$ihr@news.mic.ucla.edu>
Date: Fri, 16 Jul 1993 12:06:36 GMT
Lines: 28