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]
Other format: [Raw text]

Re: c++/9602: falsely concludes that function defined within classbody is virtual and abstract, therefore compiler fails to allow classinstantiation with pure virtual function error.


The following reply was made to PR c++/9602; it has been noted by GNATS.

From: Victor Isaac Lesk <vil@rccp.tsukuba.ac.jp>
To: <bangerth@dealii.org>, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
   <nobody@gcc.gnu.org>, <vil@rccp.tsukuba.ac.jp>, <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c++/9602: falsely concludes that function defined within class
 body is virtual and abstract, therefore compiler fails to allow class
 instantiation with pure virtual function error.
Date: Fri, 7 Feb 2003 11:22:12 +0900 (JST)

 On 6 Feb 2003 bangerth@dealii.org wrote:
 
 > Synopsis: falsely concludes that function defined within class body is virtual and abstract, therefore compiler fails to allow class instantiation with pure virtual function error.
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: bangerth
 > State-Changed-When: Thu Feb  6 23:23:46 2003
 > State-Changed-Why:
 >     For some reason, the testcase didn't make it into the
 >     report. Can you try to send it to me so that I can attach
 >     it to the report?
 >     
 >     Thanks
 >       Wolfgang
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9602
 > 
 
 Here it is:
 //////////////
 #include<iostream>
 #include<stdio.h>
 
 using namespace std;
 
 template<typename t>
 class Pair
 {
 private:
 protected:
 public:
   t first;
   t second;
   t&last;
 
   Pair();
   Pair(t,t);
   Pair(const string);
 
   void set_Pair(const t,const t);
   void set(const t,const t);
   void set_First(const t);
   void set_Second(const t);
   void set_Last(const t);
   t get_First(void)const;
   t get_Second(void)const;
   t get_Last(void)const;
   bool contains(const t)const;
   bool includes(const t)const;
 
   void display(void)const;
 
   void operator=(const Pair<t>);
 
   template<typename l>operator class Pair<l>(void)const;
 
   friend ostream&operator<<(ostream&a,const class Pair<t>&r)
     {
       return a<<r.first<<SPC<<r.second;
     }
   friend istream&operator>>(istream&a,class Pair<t>&r)
     {
       return a>>r.first>>r.second;
     }
 };
 
 template<typename t>
 ostream&
 operator<<(ostream&,const Pair<t>&);
 
 template<typename t>
 istream&
 operator>>(istream&,Pair<t>&);
 
 
 template<typename t>
 Pair<t>::
 Pair():
   last(second)
 {
 }
 
 template<typename t>
 Pair<t>::
 Pair(const string s):
   last(second)
 {
 }
 
 template<typename t>
 Pair<t>::
 Pair(t a,t b):
   last(second)
 {
   set_Pair(a,b);
 }
 
 template<typename t>
 t
 Pair<t>::
 get_First(void)const
 {
   return first;
 }
 
 template<typename t>
 t
 Pair<t>::
 get_Second(void)const
 {
   return second;
 }
 
 template<typename t>
 t
 Pair<t>::
 get_Last(void)const
 {
   return last;
 }
 
 template<typename t>
 void
 Pair<t>::
 set(t l,t h)
 {
   first=l;second=h;
 }
 
 template<typename t>
 void
 Pair<t>::
 operator=(const Pair<t> pair)
 {
   set_First(pair.first);
   set_Second(pair.second);
 }
 
 template<typename t>
 void
 Pair<t>::
 set_Pair(t l,t h)
 {
   set(l,h);
 }
 
 template<typename t>
 void
 Pair<t>::
 set_First(const t a)
 {
   first=a;
 }
 
 template<typename t>
 void
 Pair<t>::
 set_Second(const t a)
 {
   second=a;
 }
 
 template<typename t>
 bool
 Pair<t>::
 contains(const t a)const
 {
   return (a==first || a==second);
 }
 
 template<typename t>
 bool
 Pair<t>::
 includes(const t a)const
 {
   return contains(a);
 }
 
 template<typename t>
 void
 Pair<t>::
 display(void)const
 {
   cout<<LPR<<first<<COM<<second<<RPR;
 }
 
 template<typename t>template<typename l>
 Pair<t>::
 operator Pair<l>(void)const
 {
   return Pair<l>(l(first),l(second));
 }
 
 int main(const int,const char*const*const)
 {
   Pair<int> pair1;
 
 
 
   return 0;
 }
 
 
 
 


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