Depending on what you’re doing exactly the compiler might be trying to call the copy constructor rather than the assignment operator (if the object hasn’t yet been constructed).
class CustomFile
{
public:
CustomFile& operator= (const File& input);
private:
File juceFile;
};
//==============================================================================
CustomFile& CustomFile::operator= (const File& input)
{
juceFile = input;
return *this;
}
//==============================================================================
int main (int argc, char* argv[])
{
CustomFile f1 = "/file/path"; // compiler error, copy constructor not assignemnt
CustomFile f2 = String ("/file/path"); // compiler error, copy constructor not assignemnt
CustomFile f3 = File ("/file/path"); // compiler error, copy constructor not assignemnt
CustomFile f4;
f4 = "/file/path"; // compiler error, no overload for assignment operator for char[n]
CustomFile f5;
f5 = String ("/file/path"); // OK
CustomFile f6;
f6 = File ("/file/path"); // OK
return 0;
}