This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

DWP guiding decls with egcs-1.0.1


/* 
   Hi there!

   I came up with some questions and some problems with c++ and my 
   understanding of DWP, template instantiation and egcs-1.0.1.

   Compiling this programm (You can compile this text file 
   immedialtely) first I got warrning as described in egcs C++ 
   features that the guiding decls are no longer supported and that 
   function decls including friend decls do not refer to template 
   instantiations.

   So I got this for result:

rt05:gcl/example/Tests[1197]$> g++ -v egcs_template_guiding_decls.cpp
Reading specs from
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cpp -lang-c++
-v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90
-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix
-D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__
-D__hpux__ -D__unix__ -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux
-D__unix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa)
-D__EXCEPTIONS -D__hp9000s700 -D_PA_RISC1_1 -D_HPUX_SOURCE
-D_HIUX_SOURCE egcs_template_guiding_decls.cpp /var/tmp/cca17309.ii
GNU CPP version egcs-2.90.23 980102 (egcs-1.0.1 release) (hppa)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/lib/g++-include
 /usr/local/include
 /usr/local/hppa1.1-hp-hpux10.20/include
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cc1plus
/var/tmp/cca17309.ii -quiet -dumpbase egcs_template_guiding_decls.cc
-version -o /var/tmp/cca17309.s
GNU C++ version egcs-2.90.23 980102 (egcs-1.0.1 release)
(hppa1.1-hp-hpux10.20) compiled by GNU C version egcs-2.90.23 980102
(egcs-1.0.1 release).
egcs_template_guiding_decls.cpp:20: warning: friend declaration `bool
operator ==(const class X<T> &, const class X<T> &)'
egcs_template_guiding_decls.cpp:20: warning:   will not be treated as a
template instantiation
egcs_template_guiding_decls.cpp:20: warning:   unless you compile with
-fguiding-decls
egcs_template_guiding_decls.cpp:20: warning:   or add <> after the
function name
 /usr/local/hppa1.1-hp-hpux10.20/bin/as -o /var/tmp/cca173091.o
/var/tmp/cca17309.s
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/ld
-L/lib/pa1.1 -L/usr/lib/pa1.1 -z -u main /usr/ccs/lib/crt0.o
-L/usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23
-L/usr/local/hppa1.1-hp-hpux10.20/lib -L/usr/ccs/bin -L/usr/ccs/lib
-L/usr/local/lib /var/tmp/cca173091.o -lstdc++ -lm -lgcc -lc -lgcc

  Question: I've looked all over the DWP but couldn't find any 
	    references about guiding decls and in B.Stroustrup's 
	    "C++ programming language" too.
	    What are thse guiding decls and how am I supposed to 
	    declare for example operator== or operator<< ???
	    What does " add <> after the function name " mean???
	    Is it according , cos I couldn't find it in any examples
	    that I've  looked at.

 Thanx a lot  

 Miljenko


PS.

  Further, playing with this example I came up with internal compiler
  error which might interest You.


rt05:gcl/example/Tests[1196]$> g++ -v egcs_template_guiding_decls.cpp
Reading specs from
/usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cpp -lang-c++
-v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90
-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix
-D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__
-D__hpux__ -D__unix__ -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux
-D__unix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa)
-D__EXCEPTIONS -D__hp9000s700 -D_PA_RISC1_1 -D_HPUX_SOURCE
-D_HIUX_SOURCE egcs_template_guiding_decls.cpp /var/tmp/cca17297.ii
GNU CPP version egcs-2.90.23 980102 (egcs-1.0.1 release) (hppa)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/lib/g++-include
 /usr/local/include
 /usr/local/hppa1.1-hp-hpux10.20/include
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/cc1plus
/var/tmp/cca17297.ii -quiet -dumpbase egcs_template_guiding_decls.cc
-version -o /var/tmp/cca17297.s
GNU C++ version egcs-2.90.23 980102 (egcs-1.0.1 release)
(hppa1.1-hp-hpux10.20) compiled by GNU C version egcs-2.90.23 980102
(egcs-1.0.1 release).
egcs_template_guiding_decls.cpp:37: Internal compiler error.
egcs_template_guiding_decls.cpp:37: Please submit a full bug report to
`egcs-bugs@cygnus.com'.

*/ 

# define _WARRNING_
//# define _OK_
//# define _INTERNAL_COMPILER_ERROR_


template <class T>
class X
{
public:

 friend
 bool
	# if defined _OK_ || defined INTERNAL_COMPILER_ERROR_
	operator== <>
	# elif defined _WARRNING_ || defined _OK_
	operator== 
	#endif
			(
			 const X<T>& x1,
			 const X<T>& x2
			)                                                      ;
};



template <class T>
bool

	# if defined _INTERNAL_COMPILER_ERROR_
	operator== <>
	# elif defined _WARRNING_ || defined _OK_
	operator== 
	#endif
			(
			 const X<T>& x1,
			 const X<T>& x2
			)                                                              
{
  return true;
};			


int main()
{
 X<int> xi;
 X<double> xd;

 return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]