$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-06-03 20:31:44
"Jonathan Turkanis" <technews_at_[hidden]> wrote
> Arkadiy Vertleyb wrote:
>
> > I was trying to come up with a useful example of LVALUE_TYPEOF, so I
> > decided to implement the "trace" function from the motivation section
> > of decltype/auto proposal.  However I ran into unexpected problem:
> >
> > Given a function type F, and parameter type T, how to create an
> > expression for typeof to use in the return type?  I use VC71, and the
> > only thing that seems to work (but with a warning) is:
> >
> > F()(T())
>
> I'm not sure if this if what you have in mind, but the following compiles
> without warning with VC7.1, como and GCC 3.4:
>
>     struct F {
>         template<typename T>
>         int operator()(T t) { return 0; }
>     };
>
>
>     int main()
>     {
>         (void) sizeof( (*(F*)0)( *(int*)0 ) );
>     }
Actually here is a minimal example of what I meant:
template<int n> struct int_;
template<class F>
int_<sizeof( (*(F*)0)() )> foo(); // doesn't compile in VC71
template<class F>
int_<sizeof( (F())() )> foo(); // compiles with a warning in VC71
int main()
{
}