the following test program compiles , runs fine g++. intel icpc (14.0.2) compile , run if use explicit type double instead of template. template version icpc produces error: icpc -g -o2 -i. -std=c++0x -c main.cc -o main.o main.cc(10): error: member of type "const t [9]" cannot have in-class initializer static constexpr t dx_[9] = { test code template<typename t> class myclass { public: static constexpr t dx_[9] = { 1.5, 2.0, -0.5, -0.5, 0.0, 0.5, 0.5, -2.0, -1.5 }; }; template<typename t> constexpr t myclass<t>::dx_[9]; int main(int argc, char *argv[]) { return 0; } // main why receiving error "cannot have in-class initializer" when using constexpr ? this bug of intel compiler, submitted intel , fixed in future versions. also see multiple constexpr bugs , sfinae bug intel c++ compiler 15 , method constexpr bug c++ compiler 15 on intel forums.
Comments
Post a Comment