public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17775] New: -frepo with function template in anonymous namespace fails to compile
@ 2004-10-01 14:08 rainy6144 at gmail dot com
  2004-10-01 14:14 ` [Bug c++/17775] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rainy6144 at gmail dot com @ 2004-10-01 14:08 UTC (permalink / raw)
  To: gcc-bugs

This is the same bug as bug #6564.  Using the same source file and compile
options as described there, linking fails in the same way in GCC 3.4.2:

collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
collect: recompiling anontest2.cc
collect: relinking
anontest2.o(.text+0x21): In function `main':
: undefined reference to `void foo<(anonymous namespace)::Foo>((anonymous
namespace)::Foo)'
collect2: ld returned 1 exit status

The gcc in redhat linux 9 (3.2.2-5) works okay.

-- 
           Summary: -frepo with function template in anonymous namespace
                    fails to compile
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rainy6144 at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/17775] [3.3/3.4/4.0 Regression] -frepo with function template in anonymous namespace fails to compile
  2004-10-01 14:08 [Bug c++/17775] New: -frepo with function template in anonymous namespace fails to compile rainy6144 at gmail dot com
@ 2004-10-01 14:14 ` pinskia at gcc dot gnu dot org
  2004-10-01 16:04 ` bangerth at dealii dot org
  2004-10-28  6:24 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-01 14:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-01 14:14 -------
Confirmed, I think this comes from the fact that anonymous namespaces get some random name.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-01 14:14:31
               date|                            |
            Summary|-frepo with function        |[3.3/3.4/4.0 Regression] -
                   |template in anonymous       |frepo with function template
                   |namespace fails to compile  |in anonymous namespace fails
                   |                            |to compile
   Target Milestone|---                         |3.4.3


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


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

* [Bug c++/17775] [3.3/3.4/4.0 Regression] -frepo with function template in anonymous namespace fails to compile
  2004-10-01 14:08 [Bug c++/17775] New: -frepo with function template in anonymous namespace fails to compile rainy6144 at gmail dot com
  2004-10-01 14:14 ` [Bug c++/17775] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-10-01 16:04 ` bangerth at dealii dot org
  2004-10-28  6:24 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2004-10-01 16:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-10-01 16:04 -------
I assume this is broken by the fix to PR 9393. However, reverting that 
patch is going to open a much larger problem than it would fix here, given 
that not many people use -frepo. 
 
For reference, here is the code from PR 6564: 
----------------------- 
namespace { 
  struct Foo {}; 
} 
 
template <typename Tp> 
void foo(Tp) {} 
 
int 
main() 
{ 
  foo(Foo()); 
} 
--------------------------- 
g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -frepo -Wall -c x.cc  
g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -frepo -Wall x.o -o x  
collect: recompiling x.cc 
collect: relinking 
collect: recompiling x.cc 
collect: relinking 
collect: recompiling x.cc 
collect: relinking 
collect: recompiling x.cc 
collect: relinking 
collect: recompiling x.cc 
collect: relinking 
collect: recompiling x.cc 
.... 
 
W. 

-- 


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


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

* [Bug c++/17775] [3.3/3.4/4.0 Regression] -frepo with function template in anonymous namespace fails to compile
  2004-10-01 14:08 [Bug c++/17775] New: -frepo with function template in anonymous namespace fails to compile rainy6144 at gmail dot com
  2004-10-01 14:14 ` [Bug c++/17775] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
  2004-10-01 16:04 ` bangerth at dealii dot org
@ 2004-10-28  6:24 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-10-28  6:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-10-28 06:24 -------
There is really no easy way to fix this problem.  If we were to have -frepo set
the random seed to a known value, we'd then get link errors when linking
multiple translation units containing anonymous namespaces.  

We've discussed giving members of anonymous namespaces internal linkage (from
the ELF point of view) even though the C++ standard gives them external linkage.
 That's probably the right fix, but it will not happen soon.

Postponed until GCC 4.1.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.3                       |4.1.0


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


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

end of thread, other threads:[~2004-10-28  6:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-01 14:08 [Bug c++/17775] New: -frepo with function template in anonymous namespace fails to compile rainy6144 at gmail dot com
2004-10-01 14:14 ` [Bug c++/17775] [3.3/3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-10-01 16:04 ` bangerth at dealii dot org
2004-10-28  6:24 ` mmitchel 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).