Bug report(?): order of declaration with namespaces

IgorR igorr@ifi.uio.no
Wed Jan 6 09:23:00 GMT 1999


igorr@kringsjaa10 (29):
~/IfiExports$ uname -a
Linux kringsjaa10.studby.uio.no 2.0.34 #1 Fri May 8 16:05:57 EDT 1998 i586
unknown
 
igorr@kringsjaa10 (30):
~/IfiExports$ g++ --version
egcs-2.91.60


The code:

#include <iostream>





namespace Space2
{

  void tada();
}





class MyNameSpace
{
protected:
  static void foo(){  cout << "me protected MyNameSpace :: foo()" << endl;
}


  friend void Space2 :: tada();
};





void
Space2 :: tada()
{

  cout << "I'm Space2 :: tada()" << endl;
  MyNameSpace :: foo();
}


void
tada()
{

  cout << "I'm :: tada()" << endl; 
}


int
main()
{

  Space2 :: tada();

  return 0;
}


This code compiles nicely and everyone is happy. However, when I change
the order of definition of ::tada() and Space2::tada() (just swap the 2
functions in code), then bizarre things happen:

igorr@kringsjaa10 (31):
~/IfiExports$ g++ hidden_func.cpp
hidden_func.cpp: In function `void tada()':
hidden_func.cpp:39: new declaration `void tada()'
hidden_func.cpp:32: ambiguates old declaration `void tada()'


Am I doing smth. wrong or is it an undocumented feature of the latest
egcs?


Sincerely yours, 


Igor Rafienko
igorr@ifi.uio.no
-- 
"Ma belle demoiselle, repondit Candide, quand on est amoureux, jaloux 
et fouette par l'Inquisition, on ne se connait plus"
				Voltaire, "Candide"




More information about the Gcc-bugs mailing list