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
* [Bug c++/25980] Unexpected name conflict between symbols
2006-01-26 18:39 [Bug c++/25980] New: Unexpected name conflict between symbols dwhorton at gmail dot com
@ 2006-01-26 18:49 ` pinskia at gcc dot gnu dot org
2006-01-26 18:56 ` gdr at cs dot tamu dot edu
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-26 18:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-01-26 18:49 -------
I think you (and EDG) are missing what argument dependent lookup does for this
case.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25980
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25980] Unexpected name conflict between symbols
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
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: gdr at cs dot tamu dot edu @ 2006-01-26 18:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from gdr at cs dot tamu dot edu 2006-01-26 18:56 -------
Subject: Re: New: Unexpected name conflict between symbols
"dwhorton at gmail dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| 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);
| }
| }
[...]
| 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?
This is a known issue. Name lookup apply uniformly. In particular,
ADL finds in this case both function and non-function.
Since we don't have (yet) overload set that can include functions and
non-functions, the program is ill-formed. See Core Issue 218
http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#218
Notice that the last note was quite a long time ago -- before C++03
and now we're in the "extensions" timeframe. There is strong feeling
that name lookup should apply uniformly, and we should also have
overload resolution with function objects included.
I believe there alreay is a PR for this. The proper action is to
suspend it until the issue is completely resolved.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25980
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25980] Unexpected name conflict between symbols
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
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dwhorton at gmail dot com @ 2006-01-26 20:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dwhorton at gmail dot com 2006-01-26 20:27 -------
I see the issue. I am surprised that ADL causes non-functions from one
namespace to pollute another. Nonetheless given the present state of the spec
the confict as reported seems to be valid behaviour.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25980
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25980] [DR 218] Unexpected name conflict between symbols
2006-01-26 18:39 [Bug c++/25980] New: Unexpected name conflict between symbols dwhorton at gmail dot com
` (2 preceding siblings ...)
2006-01-26 20:27 ` dwhorton at gmail dot com
@ 2006-01-28 20:49 ` pinskia at gcc dot gnu dot org
2006-01-28 20:50 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-28 20:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-01-28 20:49 -------
Confirmed and then ...
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-01-28 20:49:43
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25980
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25980] [DR 218] Unexpected name conflict between symbols
2006-01-26 18:39 [Bug c++/25980] New: Unexpected name conflict between symbols dwhorton at gmail dot com
` (3 preceding siblings ...)
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
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-28 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-01-28 20:50 -------
Suspending based on the fact the defect report is still opened.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |SUSPENDED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25980
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25980] [DR 218] Unexpected name conflict between symbols
2006-01-26 18:39 [Bug c++/25980] New: Unexpected name conflict between symbols dwhorton at gmail dot com
` (4 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19 4:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2006-09-19 04:12 -------
(In reply to comment #2)
> I believe there alreay is a PR for this. The proper action is to
> suspend it until the issue is completely resolved.
Yes PR 17365.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |17365
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25980
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25980] [DR 218] Unexpected name conflict between symbols
2006-01-26 18:39 [Bug c++/25980] New: Unexpected name conflict between symbols dwhorton at gmail dot com
` (5 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19 4:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2006-09-19 04:15 -------
*** Bug 17045 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc-bugzilla at contacts dot
| |eelis dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25980
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/25980] [DR 218] Unexpected name conflict between symbols
2006-01-26 18:39 [Bug c++/25980] New: Unexpected name conflict between symbols dwhorton at gmail dot com
` (6 preceding siblings ...)
2006-09-19 4:15 ` pinskia at gcc dot gnu dot org
@ 2006-09-19 4:17 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19 4:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2006-09-19 04:16 -------
I am just going to close this as a dup of bug 17365 which is all the same
issues, finding non functions for ADL.
*** This bug has been marked as a duplicate of 17365 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |RESOLVED
Resolution| |DUPLICATE
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).