template<int SIZE>class FixedString{public: operator const char*(); void operator =(const char*); void operator =(const FixedString&); // Disallowprivate: template<int OTHERSIZE> void operator=(const FixedString<OTHERSIZE>&);}; int main(){ FixedString<10> buf1; FixedString<20> buf2; buf2 = buf1; // NO ERROR!!}
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:13:10: error: ‘void FixedString<SIZE>::operator=(const FixedString<OTHERSIZE>&) [with int OTHERSIZE = 10; int SIZE = 20]’ is private prog.cpp:21:12: error: within this context
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!