enum Direction{Forward,Backward}; template<Direction dir = Forward>class X{private: Direction my_direction_;public: void set_direction(Direction dir)//here I'm getting an error { my_direction_ = this->dir; } }; int main(){return 0;}
Standard input is empty
prog.cpp: In member function ‘void X<dir>::set_direction(Direction)’: prog.cpp:11: error: declaration of ‘Direction dir’ prog.cpp:3: error: shadows template parm ‘Direction dir’
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!