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

            Bug ID: 103906
           Summary: Illegal program not detected, ambiguous conversion
                    operator
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: agulanyan87 at gmail dot com
  Target Milestone: ---

Created attachment 52121
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52121&action=edit
A complete example of the issue

Please have a look at the file attached.

As you can see the conversion operator to int is ambiguous - both base classes
have the same conversion operator defined. So, I expect any call of this
conversion operator should result in a compilation error.

Unfortunately, gcc does not produce an error on this ambiguous call.

Interestingly, if a named member function is used instead of a conversion
operator, the error is currently detected. This is included in the example file
too.

Tried clang - the error is correctly detected on both member function and
conversion operator calls.
  • [Bug c++/103906] New: Illegal pr... agulanyan87 at gmail dot com via Gcc-bugs

Reply via email to