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

            Bug ID: 93394
           Summary: Request for operator* is ambiguous when binary and
                    unary overloads are in different base classes
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at sjnewell dot com
  Target Milestone: ---

Created attachment 47696
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47696&action=edit
Reduced test case

Test case is attached.  gcc-9.2.0 and gcc-8.3.0 (installed on a gentoo system
via portage) both report an ambiguous call to operator*:

testcase.ii: In function ‘void f()’:
testcase.ii:10:18: error: request for member ‘operator*’ is ambiguous
   10 |     auto x = b * 10;
      |                  ^~
testcase.ii:2:9: note: candidates are: ‘int T::operator*(int)’
    2 |     int operator*(int i) { return 0; }
      |         ^~~~~~~~
testcase.ii:5:9: note:                 ‘int A::operator*()’
    5 |     int operator*() { return 0; }
      |

The error message is identical when testing with c++11, c++14, c++17, gnu++11,
gnu++14, and gnu++17.  clang-9.0.1 compiles without error.

Reply via email to