https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50462
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Since GCC 4.9 we don't perform overload resolution, so I think this is fixed: 50462.C: In function 'void print(V)': 50462.C:13:13: error: invalid use of non-static member function 'int V::size()' 13 | { ostream() << v.size; } | ~~~~~~~~~~^~~~~~~~~ 50462.C:9:13: note: declared here 9 | int size() { return 0; }; | ^~~~