Location of template instantiation when I get a template compile error?

  • Thread starter Thread starter Frank Vanris
  • Start date Start date
F

Frank Vanris

Hi,

I am using boost which uses templates heavily. When I make a typo the
compiler complains, but it complains in the boost headerfile (I attached an
example at the end where I forgot to pass in a parameter). But what I
actually need to know is where this template was instantiated so that I can
fix my typo. Is there an option so that the compiler tells me the location
of instantiation?

Thanks,
Frank.


Example of compile error:

C:\Frank\Develop\boost_1_32_0\boost\lambda\detail\actions.hpp(96): error
C2780: 'void boost::lambda::function_adaptor<Func>::apply(Result (__thiscall
FVUtil::FVHtmlRules::* )(Arg1,Arg2) const,const Object &,A1 &,A2 &)' :
expects 4 arguments - 3 provided
with
[
Func=boost::lambda::return_type_N<boost::lambda::function_action<3>,boost::lambda::lambda_functor_base<boost::lambda::action<3,boost::lambda::function_action<3>>,boost::tuples::tuple<const
boost::lambda::detail::bind_traits<void (__thiscall FVUtil::FVHtmlRules::*
const )(FVUtil::FVHtmlTags,const char *) const>::type,const
boost::lambda::detail::bind_traits<const FVUtil::FVHtmlRules *const
::type,const boost::lambda::detail::bind_traits<const
FVUtil::FVHtmlTags>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type>>::sig<boost::tuples::null_type>::rets_t>::plain_Func
,
Result=void,
Arg1=FVUtil::FVHtmlTags,
Arg2=const char *,
Object=FVUtil::FVHtmlRules
]
 
Frank said:
Hi,

I am using boost which uses templates heavily. When I make a typo the
compiler complains, but it complains in the boost headerfile (I
attached an example at the end where I forgot to pass in a parameter). But
what I
actually need to know is where this template was instantiated so that
I can fix my typo. Is there an option so that the compiler tells me the
location of instantiation?

It does - just read back through the detail messages until you come to code
that you wrote. If you never come to code that you wrote, it's a lot harder
to figure out what's wrong.

Was the example you posted the complete error message?

-cd
 
I never see code I wrote, and indeed it is very hard to find out where I
made the mistake. I make micro changes so that I at least know in what area I
have to look if I get a compiler error.

The example was the complete error message. As I said, fortunately I made
microchanges so I was able to figure out that it came from the following line:

_preFormattedText = _preformattedTextKeyword[bind(&FVHtmlRules::processTag,
&self, FVHTML_TEXT)];

My change was that I added a parameter to processTag, so I should have
changed this line to

_preFormattedText = _preformattedTextKeyword[bind(&FVHtmlRules::processTag,
&self, FVHTML_TEXT, _1)];

Frank.
 
Back
Top