An innocent mistake was nearly the end of me ;-)

I have been puzzled by the effect of my mistyping causing this message. i:\trunk\boost/range/const_iterator.hpp(37) : error C2039: 'const_iterator' : is not a member of 'std::ios_base' C:\Program Files\Microsoft Visual Studio 8\VC\include\xiosbase(183) : see declaration of 'std::ios_base' i:\trunk\boost/mpl/eval_if.hpp(63) : see reference to class template instantiation 'boost::range_const_iterator<C>' being compiled with [ C=std::ios_base ] i:\trunk\boost/range/iterator.hpp(63) : see reference to class template instantiation 'boost::mpl::eval_if_c<C,F1,F2>' being compiled with [ C=true, F1=boost::range_const_iterator<std::ios_base>, F2=boost::range_mutable_iterator<const std::ios_base> ] I:\Boost-sandbox\SOC\2007\visualization\boost/svg_plot/show_2d_settings.hpp(104) : see reference to class template instantiation 'boost::range_iterator<C>' being compiled with [ C=const std::ios_base ] i:\trunk\boost/range/const_iterator.hpp(37) : error C2146: syntax error : missing ';' before identifier 'type' i:\trunk\boost/range/const_iterator.hpp(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int i:\trunk\boost/range/const_iterator.hpp(37) : error C2208: 'boost::type' : no members defined using this type i:\trunk\boost/range/const_iterator.hpp(37) : fatal error C1903: unable to recover from previous error(s); stopping compilation The "erroneous" line 37 is: template< typename C > struct range_const_iterator { typedef BOOST_DEDUCED_TYPENAME C::const_iterator type; }; And this left me in total disambiguation mode :-) The cause was simple - I typed ">> end;" when I wanted ">> endl;" In mitigation I would point out that I got the other 120 endl;'s right ;-) The compiler, lack an ounce of sense, interpreted this to the letter. I suspect I may not be first or last person to do this :-) Could the source file usefully have a comment that says something like " If you get a error "'const_iterator' : is not a member of 'std::ios_base'" here have you typed "end;" somewhere instead of "endl;" " ? Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com

Paul: Since you're sharing stories, I once spent 3 weeks with a student on a code that just didn't compute the right expression. The code was doing complicated visibility in 3D computation with lines (lots of the determinants all over the place). The error was caused in some obscure place by: double expression = some_complicated_multi_line_expression() ; + some_more_complicated_multi_line_expression(); That stray ";" was nearly the end of me too. When we found it, I felt what you must have felt with your "<< end;'" typo. Of course, the student didn't use maximum warning level (-W -Wall), otherwise the compiler (g++) would've warned us of "statement has no effect". Morale of the story, for us: "Always write warning-free code". I suspect using more than one compiler might have helped with your diagnostic. Anyways, good for you finding that typo! -- Hervé Brönnimann hervebronnimann@mac.com On Nov 30, 2007, at 9:26 AM, Paul A Bristow wrote:
I have been puzzled by the effect of my mistyping causing this message. [snip] I suspect I may not be first or last person to do this :-)
Could the source file usefully have a comment that says something like " If you get a error "'const_iterator' : is not a member of 'std::ios_base'" here have you typed "end;" somewhere instead of "endl;" " ?
Paul
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com
participants (2)
-
Hervé Brönnimann
-
Paul A Bristow