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

[Bug c++/22227] g++ 4.0.0 has issues with the typedef of reference


------- Additional Comments From bangerth at dealii dot org  2005-06-29 14:05 -------
Let me point out a few problems in your code first: 
 
list225.cpp, line 161: you can't write 
               typename const list<Etype>::iterator& origVal) const 
you need to reverse the order of const and typename, of course. This 
appears 10 times in your code. 
 
list225.cpp, line 1579 and 1580: you are missing typename keywords that the 
standard requires here. 
 
Finally, here's the place where you complain about gcc: 
  template <class Etype> 
  typename list<Etype>::reference  
                      list<Etype>::const_iterator::operator*() const 
Now, if you had looked closely at the error message g++ gave you, you 
would have seen that it points you at the declaration of this operator, 
which is in line 400 of list225.h. There you see: 
   const_reference operator*() const; 
So one can see that the return type of your definition does not coincide  
with the return type of your declaration. Not good, and a valid reason for 
a compiler to complain. You have the same problem in line 250. 
 
 
For the end, let me give you some advice, young man: it is ok to make 
mistakes, but it's also real important to realize that people in places like 
this are pretty good and if they ask you questions then probably for a good 
reason. There's no point in lecturing them about how good your school is, 
how good you think some other compiler is, etc. Show some humility and  
desire to learn from others. 
 
 
Be it resolved: INVALID. 
W. 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22227


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