public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace
@ 2003-11-20 19:49 phil dot el at wanadoo dot fr
2003-11-20 20:44 ` [Bug c++/13140] " bangerth at dealii dot org
` (7 more replies)
0 siblings, 8 replies; 14+ messages in thread
From: phil dot el at wanadoo dot fr @ 2003-11-20 19:49 UTC (permalink / raw)
To: gcc-bugs
gcc accept this illegal code, at least with 2.91, 2.95.3 and
gcc version 3.4 20031120 (experimental) so this is not a
regression
struct foo {
foo();
};
namespace bar {
foo::foo() { }
}
Comeau catch it at foo::foo() definition
error: overloaded function "foo::foo" cannot be defined in the current scope
regards,
Philippe Elie
--
Summary: declaration in global namespace, definition inside named
or anon namespace
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: phil dot el at wanadoo dot fr
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
@ 2003-11-20 20:44 ` bangerth at dealii dot org
2004-02-03 8:16 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: bangerth at dealii dot org @ 2003-11-20 20:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2003-11-20 20:44 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-11-20 20:44:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
2003-11-20 20:44 ` [Bug c++/13140] " bangerth at dealii dot org
@ 2004-02-03 8:16 ` pinskia at gcc dot gnu dot org
2004-03-23 20:15 ` bangerth at dealii dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-03 8:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-03 08:16 -------
*** Bug 13700 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |grigory dot zagorodnev at
| |intel dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
2003-11-20 20:44 ` [Bug c++/13140] " bangerth at dealii dot org
2004-02-03 8:16 ` pinskia at gcc dot gnu dot org
@ 2004-03-23 20:15 ` bangerth at dealii dot org
2004-05-26 12:31 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: bangerth at dealii dot org @ 2004-03-23 20:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-23 20:15 -------
I actually tripped over this in my own program just now. To explain why
this is a particularly evil bug: in a header file x.h I had
struct X { void f(); };
and in y.h:
namespace NS {
struct X { void f(); };
}
Then in x.cc, I would
#include "x.h"
void X::f() {};
but in y.cc I made the error to include x.h instead of y.h:
#include "x.h"
namespace NS {
void X::f() {};
}
This compiled without error, as explained in this PR, but I later got
linker errors about multiply defined symbols X::f, despite the fact that
I defined these symbols in the second .cc file in a namespace. It is thus
not only accepts-invalid, but also wrong-code. Needless to say that it was
rather tedious to find the problem...
I take the liberty to set the milestone tentatively to 3.5, in the hope
that someone comes along with a fix to this problem until then.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Known to fail| |2.95.3 3.2.3 3.3.3 3.4.0
| |3.5.0
Target Milestone|--- |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
` (2 preceding siblings ...)
2004-03-23 20:15 ` bangerth at dealii dot org
@ 2004-05-26 12:31 ` pinskia at gcc dot gnu dot org
2004-10-03 14:57 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-26 12:31 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.5.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
` (3 preceding siblings ...)
2004-05-26 12:31 ` pinskia at gcc dot gnu dot org
@ 2004-10-03 14:57 ` pinskia at gcc dot gnu dot org
2005-04-01 13:08 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-03 14:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-03 14:57 -------
*** Bug 17804 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |peter dot klotz at aon dot
| |at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
` (4 preceding siblings ...)
2004-10-03 14:57 ` pinskia at gcc dot gnu dot org
@ 2005-04-01 13:08 ` pinskia at gcc dot gnu dot org
2005-09-15 16:04 ` cvs-commit at gcc dot gnu dot org
2005-09-16 18:16 ` reichelt at gcc dot gnu dot org
7 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-01 13:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-01 13:08 -------
*** Bug 20711 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |smcpeak at cs dot berkeley
| |dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
` (5 preceding siblings ...)
2005-04-01 13:08 ` pinskia at gcc dot gnu dot org
@ 2005-09-15 16:04 ` cvs-commit at gcc dot gnu dot org
2005-09-16 18:16 ` reichelt at gcc dot gnu dot org
7 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-15 16:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-15 16:03 -------
Subject: Bug 13140
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: mmitchel@gcc.gnu.org 2005-09-15 16:03:33
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/testsuite: testsuite_character.h
gcc/cp : ChangeLog pt.c decl.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/parse: class2.C
gcc/testsuite/g++.dg/template: explicit8.C spec25.C
Log message:
PR c++/13140
* decl.c (check_class_member_definition_namespace): New function.
(grokfndecl): Use it.
(grokvardecl): Likewise.
(grokdecl): Improve documentation.
* pt.c (check_explicit_instantiation_namespace): New function.
(register_specialization): Call check_specialization_namespace
when replacing an implicitly instantiated function.
(check_explicit_specialization): Ensure that DECL_CONTEXT is set
correctly for namespace-scope specializations.
(do_decl_instantiation): Use
check_explicit_instantiation_namespace.
(do_type_instantiation): Likewise.
PR c++/13140
* g++.dg/parse/class2.C: New test.
* g++.dg/template/explicit8.C: Likewise.
* g++.dg/template/spec25.C: Likewise.
* testsuite/testsuite_character.h: Specialize character<>
templates in __gnu_cxx, not in __gnu_test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.3105&r2=1.3106
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/testsuite_character.h.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4891&r2=1.4892
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1034&r2=1.1035
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1426&r2=1.1427
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6066&r2=1.6067
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/class2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/explicit8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec25.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
` (6 preceding siblings ...)
2005-09-15 16:04 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-16 18:16 ` reichelt at gcc dot gnu dot org
7 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-09-16 18:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-09-16 18:16 -------
Fixed on mainline.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
[not found] <bug-13140-3534@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2006-06-21 23:15 ` zvonsully at gmail dot com
@ 2006-06-21 23:40 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-21 23:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from pinskia at gcc dot gnu dot org 2006-06-21 23:17 -------
(In reply to comment #11)
> on g++ v. 4.1.2 it is not fixed, But here I see "Fixed" with patches from 2005!
Fixed meaning GCC is no longer accepting invalid code. Your code is invalid
and should be rejected.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
[not found] <bug-13140-3534@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2006-06-21 23:11 ` pinskia at gcc dot gnu dot org
@ 2006-06-21 23:15 ` zvonsully at gmail dot com
2006-06-21 23:40 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 14+ messages in thread
From: zvonsully at gmail dot com @ 2006-06-21 23:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from zvonsully at gmail dot com 2006-06-21 23:11 -------
on g++ v. 4.1.2 it is not fixed, But here I see "Fixed" with patches from 2005!
code:
namespace NS{//a namespace
template<class T>
class C//a template class inside a namespace
{
int f();//a member of C
};
}//NS
//here is the specialization
template<>
int NS:: C<int>::f(){return 0;}// !! I placed NS::
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
[not found] <bug-13140-3534@http.gcc.gnu.org/bugzilla/>
2006-01-11 14:16 ` pinskia at gcc dot gnu dot org
2006-02-21 21:11 ` pinskia at gcc dot gnu dot org
@ 2006-06-21 23:11 ` pinskia at gcc dot gnu dot org
2006-06-21 23:15 ` zvonsully at gmail dot com
2006-06-21 23:40 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-21 23:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pinskia at gcc dot gnu dot org 2006-06-21 22:58 -------
*** Bug 28130 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |zvonsully at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
[not found] <bug-13140-3534@http.gcc.gnu.org/bugzilla/>
2006-01-11 14:16 ` pinskia at gcc dot gnu dot org
@ 2006-02-21 21:11 ` pinskia at gcc dot gnu dot org
2006-06-21 23:11 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-21 21:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from pinskia at gcc dot gnu dot org 2006-02-21 21:10 -------
*** Bug 26403 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tabrunn at sandia dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
[not found] <bug-13140-3534@http.gcc.gnu.org/bugzilla/>
@ 2006-01-11 14:16 ` pinskia at gcc dot gnu dot org
2006-02-21 21:11 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-11 14:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2006-01-11 14:16 -------
*** Bug 25748 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |igodard at pacbell dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13140
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2006-06-21 23:17 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-20 19:49 [Bug c++/13140] New: declaration in global namespace, definition inside named or anon namespace phil dot el at wanadoo dot fr
2003-11-20 20:44 ` [Bug c++/13140] " bangerth at dealii dot org
2004-02-03 8:16 ` pinskia at gcc dot gnu dot org
2004-03-23 20:15 ` bangerth at dealii dot org
2004-05-26 12:31 ` pinskia at gcc dot gnu dot org
2004-10-03 14:57 ` pinskia at gcc dot gnu dot org
2005-04-01 13:08 ` pinskia at gcc dot gnu dot org
2005-09-15 16:04 ` cvs-commit at gcc dot gnu dot org
2005-09-16 18:16 ` reichelt at gcc dot gnu dot org
[not found] <bug-13140-3534@http.gcc.gnu.org/bugzilla/>
2006-01-11 14:16 ` pinskia at gcc dot gnu dot org
2006-02-21 21:11 ` pinskia at gcc dot gnu dot org
2006-06-21 23:11 ` pinskia at gcc dot gnu dot org
2006-06-21 23:15 ` zvonsully at gmail dot com
2006-06-21 23:40 ` 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).