https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50462

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=77711

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
See PR 77711 comment 1 where I said:

>It's irrelevant that we can't resolve which overload to use, once name lookup
>finds that 'foo' is a function then a.foo is not a valid expression under any
>circumstances.

The same applies here. The expression 'v.size' (when not followed by
parentheses) is not valid C++. Instead of trying to resolve which operator<<
can be used for a nonsense expression we should just give an error immediately
after parsing v.size, which is what Clang does:

50462.cc:10:18: error: reference to non-static member function must be called;
did you mean to call it with no arguments?
{ std::cout << v.size; }
               ~~^~~~
                     ()
50462.cc:5:6: note: possible target for call
        int size() {};
            ^
50462.cc:6:6: note: possible target for call
        int size() const {};
            ^
1 error generated.

Reply via email to