namespace + template friend = nasty shadow

Petter Urkedal petter@matfys.lth.se
Thu Sep 3 08:27:00 GMT 1998


To my knowledge the code below is legal.  Bug report follows.

 -petter.


-------------------$ uname -a
Linux katsumoto.matfys.lth.se 2.0.34 #1 Fri May 8 16:05:57 EDT 1998 i586
unknown

-------------------$ g++ -v
Reading specs from
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.56/specs
gcc version egcs-2.91.56 19980829 (egcs-1.1 pre-release)

-------------------$ g++ nsbug.cc
nsbug.cc: In function `int main()':
nsbug.cc:14: no matching function for call to `func (int)'

-------------------$ cat nsbug.cc
void func(int) {}

namespace ns {
    template< typename T > class umeo {
 	template< typename U >
	  friend void func(const umeo<U>& x) {}
    };
}

using namespace ns;

main() {
    umeo< double > aaa;
    func(10);
}



More information about the Gcc-bugs mailing list