I tried to wrap something similar to Qt\'s shared data pointers for my purposes, and upon testing I found out that when the const function should be called, its non-const ve
test is a non-const object, so the compiler finds the best match: The non-const version. You can apply constness with static_cast though: static_cast
EDIT: As an aside, as you suspected 99.9% of the time you think you've found a compiler bug you should revisit your code as there's probably some weird quirk and the compiler is in fact following the standard.