Prevent API abuse of calling setters on temporary objects.
Review Request #121263 - Created Nov. 27, 2014 and discarded - Latest diff uploaded
|cullmann, dhaumann, kfunk|
In KDevelop we currently hit this often since our old class
previously returned a reference for the start/end getters of range
and cursor. With the help of C++11 ref qualifiers, we can detect that
and let the compiler give the user an error message:
error: cannot initialize object parameter of type 'KTextEditor::Cursor'
with an expression of type 'KTextEditor::Cursor'
Yes, the error message is pretty bad. But better than nothing? We
could also mark the && overloads of these functions as explictily
deleted, which would slightly improve the error message...
with the fixes to kdev's codebase, all of ktexteditor, kate and kdev* builds fine.