You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integer value = 10;
Float illegalFloat = static_cast<Float>(value);
The error message that comes back says:
error: call of overloaded 'Float(ren::Integer&)' is ambiguous
Really what it should say is "you can't do that". (Although whether you can do this specific case or not is up for debate in #7) Is there some static_assert or otherwise that could give a better message?
The text was updated successfully, but these errors were encountered:
Wouldn't Float(Integer) = delete; in Float be sufficient? It would probably result in a message along the lines of "use of deleted constructor [...]" while pointing to the deleted constructor and adding a "required from here" pointing to the line where the constructor was called. If you really want to inform the user, put some comment above the deleted constructor.
I should have mentioned that it's really all illegal casts that have the lack of a good message (I just noticed this one because it was a test case of something you might think would work...) So the question was about just generally improving the message...
If you write:
The error message that comes back says:
Really what it should say is "you can't do that". (Although whether you can do this specific case or not is up for debate in #7) Is there some static_assert or otherwise that could give a better message?
The text was updated successfully, but these errors were encountered: