|
Boost : |
Subject: [boost] [parameter] compiler errors with operators
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-12-04 16:40:12
Hello all,
Does Boost.Parameter support operators?
The following example is from the docs but it doesn't compile. Looking
at the preprocessed code /EP, the errors seem to be because the macro
defines a struct template postfixing it with the operator name and
symbol "template <class Args> struct boost_param_result_11operator()
{ ... };". Maybe this worked once before and it's now broken?
#include <boost/parameter.hpp>
#include <iostream>
BOOST_PARAMETER_NAME(arg1)
BOOST_PARAMETER_NAME(arg2)
struct callable2
{
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
(void), operator(), tag, (required (arg1,(int))(arg2,(int))))
{
std::cout << arg1 << ", " << arg2 << std::endl;
}
};
int main ( void )
{
callable2 c;
c(1, 2);
return 0;
}
On MSVC 8 with latest Boost trunk:
c02.cpp
c02.cpp(11) : error C2988: unrecognizable template declaration/definition
c02.cpp(11) : error C2059: syntax error : 'type'
c02.cpp(11) : error C2334: unexpected token(s) preceding '{'; skipping
apparent function body
c02.cpp(11) : error C2988: unrecognizable template declaration/definition
c02.cpp(11) : error C2059: syntax error : 'type'
c02.cpp(11) : error C2334: unexpected token(s) preceding ':'; skipping
apparent function body
c02.cpp(11) : error C2143: syntax error : missing ';' before '<'
c02.cpp(11) : error C4430: missing type specifier - int assumed. Note:
C++ does not support default-int
c02.cpp(11) : error C2238: unexpected token(s) preceding ';'
c02.cpp(11) : error C2143: syntax error : missing ';' before '<'
c02.cpp(11) : error C4430: missing type specifier - int assumed. Note:
C++ does not support default-int
c02.cpp(11) : error C2238: unexpected token(s) preceding ';'
c02.cpp(11) : error C2988: unrecognizable template declaration/definition
c02.cpp(11) : error C2059: syntax error : '<'
c02.cpp(11) : error C3861: 'boost_param_parameters_11operator':
identifier not found
c02.cpp(11) : error C2039: 'type' : is not a member of '`global namespace''
c02.cpp(11) : error C3861: 'boost_param_parameters_11operator':
identifier not found
c02.cpp(11) : error C2039: 'type' : is not a member of
'boost::parameter::aux::match'
..\..\..\..\..\boost\trunk.windows\boost/parameter/preprocessor.hpp(99)
: see declaration of 'boost::parameter::aux::match'
c02.cpp(11) : error C2039: 'type' : is not a member of '`global namespace''
c02.cpp(11) : error C2334: unexpected token(s) preceding '{'; skipping
apparent function body
c02.cpp(14) : error C2270: 'boost_param_default_11operator' :
modifiers not allowed on nonmember functions
c02.cpp(14) : error C2091: function returns function
c02.cpp(20) : error C2064: term does not evaluate to a function taking
2 arguments
Thanks.
--Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk