[Bug c++/46719] [C++0x] Cannot call variadic function template

flast at flast dot jp gcc-bugzilla@gcc.gnu.org
Tue Nov 30 20:27:00 GMT 2010


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

Kohei Takahashi <flast at flast dot jp> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |flast at flast dot jp

--- Comment #3 from Kohei Takahashi <flast at flast dot jp> 2010-11-30 19:45:34 UTC ---
The error is not bug because C++0x Lambda is not a std::function (or
boost::function and so on...).
C++0x Lambda is a unique, unnamed non-union class type. (written in n3126,
5.1.2.3. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3126.pdf)

Therefore compiler is unable to deduce template parameters that are Return,
FirstType and ArgTypes.

If you want to call function with implicitly template arguments deduction, you
should use variable, cast or constructor call like following code.

example:
  int main()
  {
    // using variable
    function< double( int ) > f = []( int x ) { return static_cast< double >( x
); };
    curry( f, 10 );

    // or casting
    curry( static_cast< function< double( int ) > >( []( int x ) { return
static_cast< double >( x ); } ), 10 );

    // or calling constructor
    curry( function< double( int ) >( []( int x ) { return static_cast< double
>( x ); } ), 10 );
  }



More information about the Gcc-bugs mailing list