[LLVMbugs] [Bug 12712] New: "error: no matching conversion for static_cast" for valid casts

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 1 04:47:49 PDT 2012


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

             Bug #: 12712
           Summary: "error: no matching conversion for static_cast" for
                    valid casts
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: lajos.vetek at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I just ran into a problem while compiling the C++ proxy classes from jace
(http://code.google.com/p/jace/).

There is a chain of static casts which compiles under gcc but fails with clang.


The distilled part which reporduces the problem is:

-------- begin -----

typedef unsigned char    jboolean;

typedef union jvalue {
    jboolean z;
} jvalue;

class JValue
{
public:
    operator jvalue() { return mValue; }
    operator jvalue() const { return mValue; }

private:
    jvalue mValue;
};

class JBoolean: public JValue
{
public:
    operator jboolean() const { return static_cast<jvalue>(*this).z; }
};

-------- end ------

Clang out of the Xcode 4.3.2 fails to build this snippet:

Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

This gcc compiles it fine:
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658)
(LLVM build 2336.1.00)

-- 
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