Compiler warning c4512 for Drawable::RenderingContext


I recently got the latest tip, and every file that includes juce_amalgamated.h give me the aforementioned warning. I like to minimize the number of warnings I get so I can spot real problems, so I wanted to get rid of it. I was surprised that I couldn’t find this mentioned anywhere - am I being overly picky? Or is there something screwy with my setup?

Anyway, I am not sure if the assignment operator is every actually needed for this class, but in case it is I implemented the following simple workaround:

add this to Drawable::RenderingContext

const RenderingContext& operator= (const RenderingContext & other) { g = other.g; transform = other.transform; opacity = other.opacity; };

I also needed to make the Graphics assignment operator from public…which was not ideal but I don’t think there’s a clean way to make a nested class a friend given that it’s a forward reference.


Thanks, I’ll tidy that up, but really, it’s not a big deal.

You’ll see that in many of my classes there’s a private copy constructor and assignment operator, with no implementation. That just avoids this warning, and stops people accidentally making a copy of something that isn’t copyable. This is just a case where I’ve forgotten to do this.


OK, thanks for that info.

Good idea with the empty assignment operator - I should start doing that too. It might also to be a good idea to assert in the assignment, in case, as you say, someone tries to use it.


There’s no need to assert - if you make it private and don’t actually give it an implementation, nobody’s going to get as far as actually calling it!