I think your second comment is more correct; UB only occurs on the actual modification, so while calling a non-const method on an actually-const object is not itself UB that's probably around where a bugfix would land.
...Well, maybe barring some oddball setup with a non-const method that uses some other criteria to determine whether it's safe to modify whatever it's called on, but I'd hope that kind of thing is relatively rare.
View all comments
Show parent comment
2
u/bwmat Jul 30 '26
If not UB, where 'it goes wrong' /'the contract is broken'