public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25980]  New: Unexpected name conflict between symbols
@ 2006-01-26 18:39 dwhorton at gmail dot com
  2006-01-26 18:49 ` [Bug c++/25980] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dwhorton at gmail dot com @ 2006-01-26 18:39 UTC (permalink / raw)
  To: gcc-bugs

The following fails to compile, it would appear that symbols from seperate
namespaces are colliding in error:

[dhorton@dev228 tmp]$ cat test2.cpp
namespace ns1 {
    class c {};
    typedef int f;

    static c x;
}

namespace ns2 {
    void f(ns1::c& cc)
    {
    }

    void g()
    {
        f(ns1::x);
    }
}
[dhorton@dev228 tmp]$ g++ -v -save-temps -Wall -c test2.cpp
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs
Configured with: /usr/local/share/gcc-3.3.2/configure -march=pentium4 :
(reconfi
gured) /usr/local/share/gcc-3.3.2/configure -march=pentium4 : (reconfigured)
/us
r/local/share/gcc-3.3.2/configure --with-arch=pentium4
Thread model: posix
gcc version 3.3.2
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1plus -E -D__GNUG__=3 -quiet
-
v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 -D_GNU_SOURCE
test2.cp
p -Wall test2.ii
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/c++/3.3.2
 /usr/local/include/c++/3.3.2/i686-pc-linux-gnu
 /usr/local/include/c++/3.3.2/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1plus -fpreprocessed test2.ii
-quiet -dumpbase test2.cpp -auxbase test2 -Wall -version -o test2.s
GNU C++ version 3.3.2 (i686-pc-linux-gnu)
        compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
test2.cpp: In function `void ns2::g()':
test2.cpp:3: error: `ns1::f' is not a function,
test2.cpp:10: error:   conflict with `void ns2::f(ns1::c&)'
test2.cpp:15: error:   in call to `f'
[dhorton@dev228 tmp]$
[dhorton@dev228 tmp]$ cat test2.*i*
# 1 "test2.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test2.cpp"
namespace ns1 {
    class c {};
    typedef int f;

    static c x;
}

namespace ns2 {
    void f(ns1::c& cc)
    {
    }

    void g()
    {
        f(ns1::x);
    }
}
[dhorton@dev228 tmp]$

I don't see why symbols ns1::f and ns2::f are in conflict here, as when f() in
ns2::g is being resolved ns1::f should not be visible, should it?

If the parameter ns1::x is removed from the signature of ns2::f then there is
no error.  It would appear that the ns1 namespace is being opened up as a
result of the parameter.

The online Comeau C/C++ compiler accepts this particular example.


-- 
           Summary: Unexpected name conflict between symbols
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dwhorton at gmail dot com


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


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

end of thread, other threads:[~2006-09-19  4:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-26 18:39 [Bug c++/25980] New: Unexpected name conflict between symbols dwhorton at gmail dot com
2006-01-26 18:49 ` [Bug c++/25980] " pinskia at gcc dot gnu dot org
2006-01-26 18:56 ` gdr at cs dot tamu dot edu
2006-01-26 20:27 ` dwhorton at gmail dot com
2006-01-28 20:49 ` [Bug c++/25980] [DR 218] " pinskia at gcc dot gnu dot org
2006-01-28 20:50 ` pinskia at gcc dot gnu dot org
2006-09-19  4:12 ` pinskia at gcc dot gnu dot org
2006-09-19  4:15 ` pinskia at gcc dot gnu dot org
2006-09-19  4:17 ` pinskia at gcc dot gnu dot org

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).