[LLVMbugs] [Bug 8253] New: Apparent false ambiguous conversion from derived class to base class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 28 21:24:23 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8253

           Summary: Apparent false ambiguous conversion from derived class
                    to base class
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: d235j.1 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The attached file uses a function called debugger_instruction_hook() which
accepts a parameter of the class device_t. This function is called with a
parameter of class adsp21xx_device. This class inherits from public cpu_device,
which in turn inherits from the four different classes shown in the error
output. These classes, in turn, all inherit from class device_interface, which
has an overloaded * operator to return the pointer to the internal device_t
member of the class.

>From quite a bit of digging through the code, it does not appear there should
be an error. Both g++ and MSVC++ don't even issue a warning! Of course, it
might be a bug in this code, but I have a hard time seeing how that's possible.
Preprocessed source code is attached.

Error output:


In file included from src/emu/cpu/adsp2100/adsp2100.c:1:
src/emu/cpu/adsp2100/adsp2100.c:1272:30: error: ambiguous conversion from
derived class 'adsp21xx_device' to base class 'device_interface':
    class adsp21xx_device -> class cpu_device -> class device_execute_interface
-> class device_interface
    class adsp21xx_device -> class cpu_device -> class device_memory_interface
-> class device_interface
    class adsp21xx_device -> class cpu_device -> class device_state_interface
-> class device_interface
    class adsp21xx_device -> class cpu_device -> class device_disasm_interface
-> class device_interface
   debugger_instruction_hook(*this, m_pc);
                             ^~~~~

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list