public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39205] New: Warning when object syntax is used to call a static member function
@ 2009-02-16 17:24 pgrealis at yahoo-inc dot com
2009-02-17 11:04 ` [Bug c++/39205] " rguenth at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: pgrealis at yahoo-inc dot com @ 2009-02-16 17:24 UTC (permalink / raw)
To: gcc-bugs
I can't think of a scenario where one would want to write x.f() over X::f()
when f() is static. I'd like a warning for this so I can catch with -Werror.
% g++ --version
g++ (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)
Copyright (C) 2004 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.
% uname -a
Linux norway.corp.ukl.yahoo.com 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST
2006 x86_64 x86_64 x86_64 GNU/Linux
cat t1.cpp
struct X
{
void foo() {}
static void bar() {}
};
int main()
{
X x;
x.foo();
X::bar();
x.bar(); // *** I'd like a warning for this ***
}
g++ t1.cpp
--
Summary: Warning when object syntax is used to call a static
member function
Product: gcc
Version: 3.4.5
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pgrealis at yahoo-inc dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39205
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/39205] Warning when object syntax is used to call a static member function
2009-02-16 17:24 [Bug c++/39205] New: Warning when object syntax is used to call a static member function pgrealis at yahoo-inc dot com
@ 2009-02-17 11:04 ` rguenth at gcc dot gnu dot org
2009-02-17 11:06 ` paolo dot carlini at oracle dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-17 11:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-02-17 11:04 -------
This is perfectly valid C++.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39205
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/39205] Warning when object syntax is used to call a static member function
2009-02-16 17:24 [Bug c++/39205] New: Warning when object syntax is used to call a static member function pgrealis at yahoo-inc dot com
2009-02-17 11:04 ` [Bug c++/39205] " rguenth at gcc dot gnu dot org
@ 2009-02-17 11:06 ` paolo dot carlini at oracle dot com
2009-02-17 11:21 ` pgrealis at yahoo-inc dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-02-17 11:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo dot carlini at oracle dot com 2009-02-17 11:06 -------
Yeah...
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39205
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/39205] Warning when object syntax is used to call a static member function
2009-02-16 17:24 [Bug c++/39205] New: Warning when object syntax is used to call a static member function pgrealis at yahoo-inc dot com
2009-02-17 11:04 ` [Bug c++/39205] " rguenth at gcc dot gnu dot org
2009-02-17 11:06 ` paolo dot carlini at oracle dot com
@ 2009-02-17 11:21 ` pgrealis at yahoo-inc dot com
2009-02-17 11:32 ` paolo dot carlini at oracle dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pgrealis at yahoo-inc dot com @ 2009-02-17 11:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pgrealis at yahoo-inc dot com 2009-02-17 11:20 -------
(In reply to comment #1)
> This is perfectly valid C++.
I never claimed anything different. Is your argument that no warning should be
issued for "perfectly valid C++"?
"(int)1.5" is perfectly valid C++, yet -Wold-style-cast will emit a warning for
its use.
To close as INVALID, please refute the following:
> I can't think of a scenario where one would want to write x.f() over X::f()
> when f() is static.
--
pgrealis at yahoo-inc dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pgrealis at yahoo-inc dot
| |com
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39205
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/39205] Warning when object syntax is used to call a static member function
2009-02-16 17:24 [Bug c++/39205] New: Warning when object syntax is used to call a static member function pgrealis at yahoo-inc dot com
` (2 preceding siblings ...)
2009-02-17 11:21 ` pgrealis at yahoo-inc dot com
@ 2009-02-17 11:32 ` paolo dot carlini at oracle dot com
2009-02-17 15:49 ` sebor at roguewave dot com
2009-02-17 15:51 ` paolo dot carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-02-17 11:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paolo dot carlini at oracle dot com 2009-02-17 11:32 -------
Refute? This is not philosophy. If the maintainers believe there is nothing
wrong here - and other extremely high-quality C++ front-end agree, by the way -
the issue is closed.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39205
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/39205] Warning when object syntax is used to call a static member function
2009-02-16 17:24 [Bug c++/39205] New: Warning when object syntax is used to call a static member function pgrealis at yahoo-inc dot com
` (3 preceding siblings ...)
2009-02-17 11:32 ` paolo dot carlini at oracle dot com
@ 2009-02-17 15:49 ` sebor at roguewave dot com
2009-02-17 15:51 ` paolo dot carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: sebor at roguewave dot com @ 2009-02-17 15:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from sebor at roguewave dot com 2009-02-17 15:48 -------
(In reply to comment #0)
> I can't think of a scenario where one would want to write x.f() over X::f()
> when f() is static. I'd like a warning for this so I can catch with -Werror.
FWIW, I've seen x.y when y is a static data member of x in cases such as:
extern std::ostream x;
x.setf (x.showpos);
i.e., instead of spelling showpos as "std::ios::showpos." I can envision
similar cases where y is a static member function of the class, such as
std::ios::sync_with_stdio():
x.sync_with_stdio (false);
While I appreciate the desire to find such cases I'm not sure a warning
is the appropriate mechanism.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39205
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/39205] Warning when object syntax is used to call a static member function
2009-02-16 17:24 [Bug c++/39205] New: Warning when object syntax is used to call a static member function pgrealis at yahoo-inc dot com
` (4 preceding siblings ...)
2009-02-17 15:49 ` sebor at roguewave dot com
@ 2009-02-17 15:51 ` paolo dot carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-02-17 15:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot carlini at oracle dot com 2009-02-17 15:51 -------
Thanks Martin ;)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39205
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-02-17 15:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-16 17:24 [Bug c++/39205] New: Warning when object syntax is used to call a static member function pgrealis at yahoo-inc dot com
2009-02-17 11:04 ` [Bug c++/39205] " rguenth at gcc dot gnu dot org
2009-02-17 11:06 ` paolo dot carlini at oracle dot com
2009-02-17 11:21 ` pgrealis at yahoo-inc dot com
2009-02-17 11:32 ` paolo dot carlini at oracle dot com
2009-02-17 15:49 ` sebor at roguewave dot com
2009-02-17 15:51 ` paolo dot carlini at oracle dot com
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).