[LLVMbugs] [Bug 17922] New: Can't C-style cast from template Objective-C++ class to Objective-C pointer although explicit conversion operator defined

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 13 17:51:26 PST 2013


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

            Bug ID: 17922
           Summary: Can't C-style cast from template Objective-C++ class
                    to Objective-C pointer although explicit conversion
                    operator defined
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dfarler at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

template<typename T> struct RetainPtr {
explicit operator T*() const;
};

@interface A
- (void)b;
@end

@interface B : A
- (void)c;
@end

void f(RetainPtr<A> a)
{
    [a b];
    [(B *)a c];
}


Yields:

error: cannot convert 'RetainPtr<A>' to 'B *' without a conversion operator
    [(B *)a c];
     ^~~~~~
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131114/32fa22b3/attachment.html>


More information about the llvm-bugs mailing list