[LLVMbugs] [Bug 7934] New: user-defined conversion sequence wrongly considered ambiguous

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 18 14:17:18 PDT 2010


           Summary: user-defined conversion sequence wrongly considered
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: compile-fail
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

The following testcase fails to compile with clang:

  typedef unsigned char uint8;

  struct MutablePtr {
    MutablePtr() : ptr(NULL) {}
    void *ptr;

    operator void*() { return ptr; }
    operator uint8*() { return reinterpret_cast<uint8*>(ptr); }
    operator const char*() const { return reinterpret_cast<const char*>(ptr); }

  void fake_memcpy(const void *);

  void use() {
    MutablePtr ptr;

which claims that the choice of conversion operator is ambiguous. I disagree,
it should be choosing the void* choice which has a rank of exact match while
the other two are conversion rank.

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