This is the mail archive of the gcc-prs@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]

c++/43: Re: C++ gcc-2.95. bug/problem



>Number:         43
>Category:       c++
>Synopsis:       [not accepted] friend operators
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 04 15:46:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Schirra <stschirr@mpi-sb.mpg.de>
>Release:        2.95.2
>Organization:
>Environment:
>Description:
 Original-Message-Id: <199908081039.MAA26290@mpii01807.ag1.mpi-sb.mpg.de>
 Date: Sun, 08 Aug 1999 12:39:35 +0200


 There seems to be a problem with specialised template friend
 functions in a class template when there are also member functions
 with the same name. The requested info for a bug report is below. (I
 have the same problem under Linux on my notebook - so this seems to
 be platform independent; the same problem arises if namespace is not
 used; the same problems arises if instead of operator- we have plain
 functions). Thanks.

 g++ -v --save-temps specialized_template_friend_member_function_overload_problem.C

 ---

 Reading specs from /KM/usr/naeher/gcc-2.95/lib/gcc-lib/sparc-sun-solaris2.6/2.95/specs
 gcc version 2.95 19990728 (release)
  /KM/usr/naeher/gcc-2.95/lib/gcc-lib/sparc-sun-solaris2.6/2.95/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) specialized_template_friend_member_function_overload_problem.C specialized_template_friend_member_function_overload_problem.ii
 GNU CPP version 2.95 19990728 (release) (sparc)
 #include "..." search starts here:
 #include <...> search starts here:
  /KM/usr/naeher/gcc-2.95/lib/gcc-lib/sparc-sun-solaris2.6/2.95/../../../../include/g++-3
  /KM/usr/naeher/gcc-2.95/include
  /KM/usr/naeher/gcc-2.95/lib/gcc-lib/sparc-sun-solaris2.6/2.95/../../../../sparc-sun-solaris2.6/include
  /KM/usr/naeher/gcc-2.95/lib/gcc-lib/sparc-sun-solaris2.6/2.95/include
  /usr/include
 End of search list.
 The following default directories have been omitted from the search path:
 End of omitted list.
  /KM/usr/naeher/gcc-2.95/lib/gcc-lib/sparc-sun-solaris2.6/2.95/cc1plus specialized_template_friend_member_function_overload_problem.ii -quiet -dumpbase specialized_template_friend_member_function_overload_problem.cc -version -o specialized_template_friend_member_function_overload_problem.s
 GNU C++ version 2.95 19990728 (release) (sparc-sun-solaris2.6) compiled by GNU C version 2.7.2.3.
 specialized_template_friend_member_function_overload_problem.C: In instantiation of `CGAL::V<double>':
 specialized_template_friend_member_function_overload_problem.C:54:   instantiated from here
 specialized_template_friend_member_function_overload_problem.C:31: invalid use of undefined type `class CGAL::V<double>'
 specialized_template_friend_member_function_overload_problem.C:33: forward declaration of `class CGAL::V<double>'
 specialized_template_friend_member_function_overload_problem.C:31: confused by earlier errors, bailing out

 ---

 specialized_template_friend_member_function_overload_problem.ii:

 # 1 "specialized_template_friend_member_function_overload_problem.C"



 namespace CGAL{

 template <class T> class P;
 template <class T> class V;

 class O {};

 template <class T>   V<T> operator-( const P<T>&, const O& );

 template <class T>
 class P
 {
   T _a;
   P( const V<T>& v) : _a(v.x()) {}
  public:
   P( const T& a) : _a(a) {}
   T x() { return _a; }
 };

 template <class T>
 class V
 {
   T _b;
   V( const P<T>& p) : _b(p.x()) {}
  public:
   V( const T& a) : _b(a) {}
	  V<T> operator-();
   friend V<T> operator-<>( const P<T>& a, const O& );
   T x() { return _b; }
 };


 template <class T> 

 V<T> 
 operator-( const P<T>& p, const O& )
 { return V<T>( p); }

 template <class T>

 V<T>
 V<T>::operator-()
 { return V<T>( -_b); }

 }  


 int
 main()
 {
   CGAL::P<double> a(1.0);
   CGAL::V<double> b(1.0);

   return 0;
 }


>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:

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