public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60025] New: Static member of class not found if class name == namespace name it's defined in
@ 2014-02-01 16:17 ppilar11 at gmail dot com
2014-02-14 17:21 ` [Bug c++/60025] Static member of class not found if class name == name of namespace " ppilar11 at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: ppilar11 at gmail dot com @ 2014-02-01 16:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60025
Bug ID: 60025
Summary: Static member of class not found if class name ==
namespace name it's defined in
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppilar11 at gmail dot com
Consider this definition:
namespace Foo
{
int x;
class Foo
{
public:
static int x;
};
int Foo::x;
}
and test code in which it's used:
int main()
{
using namespace Foo;
Foo::x;
return 0;
}
Both gcc 4.7.2 and gcc 4.8.1 accept the above code even though
Foo::x is ambiguous: could be either a global variable in namespace Foo
or static member of class Foo. Visual C++ 2013 rejects the code with "error
C2872: 'Foo' : ambiguous symbol could be 'Foo' or 'Foo::Foo'", gcc simply
resolves Foo::x to global variable x.
If I comment out the global variable x from namespace definition then
both gcc 4.7.2 and gcc 4.8.1 reject the code with
"error: 'x' is not a member of 'Foo'", so they fail to find the static member
of class Foo unless I qualify it as Foo::Foo::x (which should not be necessary
due to "using" directive).
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/60025] Static member of class not found if class name == name of namespace it's defined in
2014-02-01 16:17 [Bug c++/60025] New: Static member of class not found if class name == namespace name it's defined in ppilar11 at gmail dot com
@ 2014-02-14 17:21 ` ppilar11 at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: ppilar11 at gmail dot com @ 2014-02-14 17:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60025
--- Comment #1 from Piotr Pilarczyk <ppilar11 at gmail dot com> ---
Any feedback? Is it in fact a g++ bug?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-14 17:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-01 16:17 [Bug c++/60025] New: Static member of class not found if class name == namespace name it's defined in ppilar11 at gmail dot com
2014-02-14 17:21 ` [Bug c++/60025] Static member of class not found if class name == name of namespace " ppilar11 at gmail 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).