- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I had logged a similar query here https://software.intel.com/en-us/forums/topic/517612
With reference to the code below, it looks like a possible compiler bug in compile code for intel MIC architecture.
with intel composer xe 2013 sp1 update 3 (trial)
Compile command : icpc -mmic -std=c++11 -I/home/aniketnp/boost_with intel composer xe 2013 sp1 update 3 (trial) 1_55_0 test.cpp
#include <iostream> #include <boost/bind.hpp> using namespace std; struct Info_t { int start; int end; Info_t(int s=0,int e=0) : start(s), end(e) { } }; template<typename Time> struct my_functor { public: my_functor() { } my_functor(Time& time_) : time(time_) { } typedef void result_type; template<typename info_t> void operator()(const info_t& info1, const info_t& info2) const { if ((info2.start < info2.end) && (info2.end > info1.end) ) { if ( info1.end < info2.start) //NOTE THIS LINE " < " std::cout << " hi " << std::endl; } } private: Time& time; }; int main() { Info_t i1(10,2); Info_t i2(2,10); int t = 1; //auto func = boost::bind( my_functor<int>(t), _1, _2 ); auto func = std::bind( my_functor<int>(t), std::placeholders::_1, std::placeholders::_2 ); func(i1,i2); return 0; }
Gives the error as
test.cpp(24): error: expression must have a constant value if ( info1.end < info2.start) ^ detected during: instantiation of "_Result std::_Bind<_Functor (_Bound_args...)>::__call<_Result,_Args...,_Indexes...>(std::tuple<_Args...> &&, std::_Index_tuple<_Indexes...>) [with _Functor=my_functor<int>, _Bound_args=<std::_Placeholder<1>, std::_Placeholder<2>>, _Result=void, _Args=<Info_t &, Info_t &>, _Indexes=<0, 1>]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional" instantiation of "_Result std::_Bind<_Functor (_Bound_args...)>::operator()(_Args &&...) [with _Functor=my_functor<int>, _Bound_args=<std::_Placeholder<1>, std::_Placeholder<2>>, _Args=<Info_t &, Info_t &>, _Result=void]" at line 39 test.cpp(24): error: this operator is not allowed in a template argument expression if ( info1.end < info2.start) ^ detected during: instantiation of "_Result std::_Bind<_Functor (_Bound_args...)>::__call<_Result,_Args...,_Indexes...>(std::tuple<_Args...> &&, std::_Index_tuple<_Indexes...>) [with _Functor=my_functor<int>, _Bound_args=<std::_Placeholder<1>, std::_Placeholder<2>>, _Result=void, _Args=<Info_t &, Info_t &>, _Indexes=<0, 1>]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional" instantiation of "_Result std::_Bind<_Functor (_Bound_args...)>::operator()(_Args &&...) [with _Functor=my_functor<int>, _Bound_args=<std::_Placeholder<1>, std::_Placeholder<2>>, _Args=<Info_t &, Info_t &>, _Result=void]" at line 39 test.cpp(24): error: expected a ">" if ( info1.end < info2.start) ^ detected during: instantiation of "_Result std::_Bind<_Functor (_Bound_args...)>::__call<_Result,_Args...,_Indexes...>(std::tuple<_Args...> &&, std::_Index_tuple<_Indexes...>) [with _Functor=my_functor<int>, _Bound_args=<std::_Placeholder<1>, std::_Placeholder<2>>, _Result=void, _Args=<Info_t &, Info_t &>, _Indexes=<0, 1>]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional" instantiation of "_Result std::_Bind<_Functor (_Bound_args...)>::operator()(_Args &&...) [with _Functor=my_functor<int>, _Bound_args=<std::_Placeholder<1>, std::_Placeholder<2>>, _Args=<Info_t &, Info_t &>, _Result=void]" at line 39 compilation aborted for test.cpp (code 2)
POSSIBLE REASON:
Compiler interprets this as a member template, because of which it gives expected " > "
Now if I change the code to this :
if ( info1.end > info2.start) // NOTE THE " > " SIGN
There is no error in compiling. IT works fine.
Is this a possible bug for compiling with -mmic flag ? If I compile without -mmic flag, the compilation does not give any error.
Kindly confirm. Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the additional details. This is a variant of the error reported earlier with the 13.0 compiler here (https://software.intel.com/en-us/forums/topic/517612) so I will post any further information from Development in the earlier cited posting.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page