-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Hi boost developers.
I have some compilation trouble when I want to use a BOOST_PARAMETER_MEMBER_FUNCTION with no required argument in a template class. There is no issue for non template class or if I add one require arg.
This code can reproduce my issue (tested with several version of boost 1.65,1.69,1.70,1.71,1.72)
#include <iostream>
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME(arg1)
template <typename T>
struct somebody
{
BOOST_PARAMETER_MEMBER_FUNCTION(
(void), static f, tag, (optional (arg1,(int),0))
)
{
std::cout << arg1 << std::endl;
}
};
#include <boost/core/lightweight_test.hpp>
int main()
{
somebody<double>::f();
somebody<double>::f(4);
return boost::report_errors();
}
The error obtained with clang++ :
error: template argument for template type parameter must be a type; did you forget 'typename'?
The error obtained with g++ :
In file included from /usr/include/boost/parameter.hpp:18,
from test_boostparameter.cpp:2:
test_boostparameter.cpp:9:3: error: type/value mismatch at argument 1 in template parameter list for 'template<class T> template<class Args> struct somebody<T>::boost_param_result_11f'
BOOST_PARAMETER_MEMBER_FUNCTION(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_boostparameter.cpp:9:3: note: expected a type, got 'boost::parameter::aux::argument_pack<somebody<T>::boost_param_params_11f<int> >::type'
test_boostparameter.cpp:9:3: error: expected ';' at end of member declaration
BOOST_PARAMETER_MEMBER_FUNCTION(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_boostparameter.cpp: In function 'int main()':
test_boostparameter.cpp:21:23: error: cannot call member function 'int somebody<T>::f() [with T = double]' without object
somebody<double>::f();
Metadata
Metadata
Assignees
Labels
No labels