public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24986]  New: g++ is confused when function is defined inside and outside some namespace and called with '::' prefix
@ 2005-11-22  4:33 relf at os2 dot ru
  2005-11-22  4:34 ` [Bug c++/24986] " relf at os2 dot ru
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: relf at os2 dot ru @ 2005-11-22  4:33 UTC (permalink / raw)
  To: gcc-bugs

g++ (GCC) 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)

g++ fails to compile the attached program with the following error

$ g++ bug.cpp
bug.cpp: In member function 'void B::foo(N::C)':
bug.cpp:12: error: cannot convert 'N::C' to 'long int' for argument '1' to
'void foo(long int)'

Note that removing namespace enclosure make the program compile fine.


-- 
           Summary: g++ is confused when function is defined inside and
                    outside some namespace and called with '::' prefix
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: relf at os2 dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24986


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24986] g++ is confused when function is defined inside and outside some namespace and called with '::' prefix
  2005-11-22  4:33 [Bug c++/24986] New: g++ is confused when function is defined inside and outside some namespace and called with '::' prefix relf at os2 dot ru
@ 2005-11-22  4:34 ` relf at os2 dot ru
  2005-11-22  5:13 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: relf at os2 dot ru @ 2005-11-22  4:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from relf at os2 dot ru  2005-11-22 04:33 -------
Created an attachment (id=10318)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10318&action=view)
Testcase (bug.cpp)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24986


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24986] g++ is confused when function is defined inside and outside some namespace and called with '::' prefix
  2005-11-22  4:33 [Bug c++/24986] New: g++ is confused when function is defined inside and outside some namespace and called with '::' prefix relf at os2 dot ru
  2005-11-22  4:34 ` [Bug c++/24986] " relf at os2 dot ru
@ 2005-11-22  5:13 ` pinskia at gcc dot gnu dot org
  2005-11-22 12:10 ` relf at os2 dot ru
  2005-11-23  5:31 ` bangerth at dealii dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-22  5:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-11-22 05:13 -------
I don't think this is a bug as what is happening is that :: is a qualified name
and qualified namelookup (IIRC) does not find decls which are injected via
using.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24986


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24986] g++ is confused when function is defined inside and outside some namespace and called with '::' prefix
  2005-11-22  4:33 [Bug c++/24986] New: g++ is confused when function is defined inside and outside some namespace and called with '::' prefix relf at os2 dot ru
  2005-11-22  4:34 ` [Bug c++/24986] " relf at os2 dot ru
  2005-11-22  5:13 ` pinskia at gcc dot gnu dot org
@ 2005-11-22 12:10 ` relf at os2 dot ru
  2005-11-23  5:31 ` bangerth at dealii dot org
  3 siblings, 0 replies; 6+ messages in thread
From: relf at os2 dot ru @ 2005-11-22 12:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from relf at os2 dot ru  2005-11-22 12:10 -------
(In reply to comment #2)
> I don't think this is a bug as what is happening is that :: is a qualified name
> and qualified namelookup (IIRC) does not find decls which are injected via
> using.
> 

It does find. The following program (where `foo(long)` is commented out) is
compiled fine.

===
namespace N {
  class C {};
  void foo(C) {};
}
using namespace N;

/* void foo(long) {}; */

class B {
public:
/*  void foo(long l) { ::foo(l); }; */
  void foo(C c) { ::foo(c); };
};

int main() {
  B b;
  return 0;
}
===


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24986


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24986] g++ is confused when function is defined inside and outside some namespace and called with '::' prefix
  2005-11-22  4:33 [Bug c++/24986] New: g++ is confused when function is defined inside and outside some namespace and called with '::' prefix relf at os2 dot ru
                   ` (2 preceding siblings ...)
  2005-11-22 12:10 ` relf at os2 dot ru
@ 2005-11-23  5:31 ` bangerth at dealii dot org
  3 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2005-11-23  5:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bangerth at dealii dot org  2005-11-23 05:31 -------
I don't have chapter and verse to justify this, but icc and gcc agree
that they should reject this code
--------------
namespace N {
  class C {};
  void foo(C) {};
}
using namespace N;

void foo(long) {};

void bar() { C c; ::foo(c); };
---------------------
while they both accept the code with ::foo(long) removed:
---------------------
namespace N {
  class C {};
  void foo(C) {};
}
using namespace N;

void bar() { C c; ::foo(c); };
---------------------

One may certainly be tempted to find this confusing.

W.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24986


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24986] g++ is confused when function is defined inside and outside some namespace and called with '::' prefix
       [not found] <bug-24986-4@http.gcc.gnu.org/bugzilla/>
@ 2011-12-22 18:44 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-22 18:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24986

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org |
         Resolution|                            |INVALID

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-22 18:15:19 UTC ---
Closing.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-12-22 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-22  4:33 [Bug c++/24986] New: g++ is confused when function is defined inside and outside some namespace and called with '::' prefix relf at os2 dot ru
2005-11-22  4:34 ` [Bug c++/24986] " relf at os2 dot ru
2005-11-22  5:13 ` pinskia at gcc dot gnu dot org
2005-11-22 12:10 ` relf at os2 dot ru
2005-11-23  5:31 ` bangerth at dealii dot org
     [not found] <bug-24986-4@http.gcc.gnu.org/bugzilla/>
2011-12-22 18:44 ` paolo.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).