[Bug c++/68188] Ambiguous code gets compiled successfully when class and its namespace have the same name

2016-06-10 Thread ppilar11 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68188

--- Comment #4 from Piotr Pilarczyk  ---
Still present in 6.1, what's the current status of this bug (for some reason
it's still marked as unconfirmed)? Will it ever get fixed or is it simply
ignored?

[Bug c++/68188] Ambiguous code gets compiled successfully when class and its namespace have the same name

2016-01-14 Thread ppilar11 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68188

--- Comment #3 from Piotr Pilarczyk  ---
Still not fixed in 5.3.0, tested here:

https://gcc.godbolt.org/

[Bug c++/68188] New: Ambiguous code gets compiled successfully when class and its namespace have the same name

2015-11-02 Thread ppilar11 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68188

Bug ID: 68188
   Summary: Ambiguous code gets compiled successfully when class
and its namespace have the same name
   Product: gcc
   Version: 5.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ppilar11 at gmail dot com
  Target Milestone: ---

I reported this nearly 2 years ago (#60025), but my bug report was completely
ignored and the problem still persists.

Consider the following code:

namespace Foo
{
int x;

class Foo
{
public:
static int x;
};

int Foo::x;
}

int main()
{
   using namespace Foo;
   Foo::x;
   return 0;
} 

g++ 5.2.0 accepts it even though Foo::x is ambiguous: it could be either a
global variable in namespace Foo or a static member of class Foo. Visual C++
2013 rejects the code with "error C2872: 'Foo' : ambiguous symbol could be
'Foo' or 'Foo::Foo'" while g++ simply resolves Foo::x to the global variable x,
so it apparently fails to find the static member of class Foo. The problem has
been present since at least g++ 4.7.2.

Maybe I'm wrong, but I think there's one more problem with the above code.
If I comment out the global variable x from namespace definition then 
compilation fails with the following error:

"error: 'x' is not a member of 'Foo'"

so g++ fails 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, am I right?

[Bug c++/60025] Static member of class not found if class name == name of namespace it's defined in

2014-02-14 Thread ppilar11 at gmail dot com
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?


[Bug c++/60025] New: Static member of class not found if class name == namespace name it's defined in

2014-02-01 Thread ppilar11 at gmail dot com
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).