This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/39205] New: Warning when object syntax is used to call a static member function
- From: "pgrealis at yahoo-inc dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Feb 2009 17:23:51 -0000
- Subject: [Bug c++/39205] New: Warning when object syntax is used to call a static member function
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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