[Bug c++/15664] Linker fails to find (inline) function

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Thu May 27 13:50:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-05-26 20:56 -------
Alright, that's better. I think this actually shows a gcc bug: 
------------------ 
template <int N> struct S { 
    template<template<typename> class A> 
    friend void foo(); 
}; 
 
template<template<typename> class A> 
void foo(); 
 
template <typename> struct X {}; 
 
int main () { 
  S<1> s; 
  foo<X>(); 
} 
------------------- 
The friend declaration should inject the name into the global namespace, 
and it should be identified with the other declaration. However, we get 
this: 
 
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc 
x.cc: In function `int main()': 
x.cc:13: error: call of overloaded `foo()' is ambiguous 
x.cc:7: error: candidates are: void foo() [with A = X] 
x.cc:3: error:                 void foo() [with A = X, int N = 1] 
 
(Note also that the last line is pretty bad, since it lists the 
template argument to the enclosing class, which, however, isn't 
specified at all in the rest of the line.) Interestingly enough, 
the error goes away if  
a) S is made a non-template 
b) foo takes as template argument not a template template parameter, 
   but a regular type or value 
 
May someone else try to figure out from this what's going wrong. 
 
This bug is on all versions of gcc. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |2.95.3 3.3.4 3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-26 20:56:41
               date|                            |


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



More information about the Gcc-bugs mailing list