Hi Devs,
consider below reduced testcase from boost lamda.
$cat result_of_tests.cpp
#include
#include
template typename boost::result_of::type apply1(F
f, A b) {
return f(b);
}
using namespace boost::lambda;
int main(int, char *[]) {
int one = 1;
int d= (apply1<int>(_1 ,one) == 1);
printf("\n%d\n",d);
return 0;
}
when compiled with optimization O2
$g++ result_of_tests.cpp -I ./boost_1_70_0 -O2
$./a.out
0
And,when we compile same testcase with O0
$g++ result_of_tests.cpp -I ./boost_1_70_0 -O0
$./a.out
1
The above testcases is demonstrated with g++ compiler but behavior is same
on clang as well.
so we thought that this may be boost testcase issue.
When we replace ,
int d= (apply1<int>(_1 ,one) == 1);
with
int d= (apply1(_1 ,one) == 1);
testcase gives correct result with or without optimization.
Wanted to confirm here,is it valid testcase or we have to modify testcase
as per above?
Thanks,
Navya