[LLVMbugs] [Bug 21128] New: Allow a pseudo-destructor call on a pointer to a forward declared ObjC class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 1 17:40:21 PDT 2014


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

            Bug ID: 21128
           Summary: Allow a pseudo-destructor call on a pointer to a
                    forward declared ObjC class
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: akyrtzi at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following snippet triggers a compiler error for the ObjC class pointer:
 error: member access into incomplete type 'ObjCForwardClass'

class CXXForwardClass;
@class ObjCForwardClass;

template <typename T>
void destroy () { T u; u.~T(); }

int main () {
    destroy<CXXForwardClass*>();
    destroy<ObjCForwardClass*>();
}


Per John McCall's comments:

"Pointers to forward-declared Objective-C classes are still complete types. 
They should be both destructible and (outside of ARC) non-trivially
destructible.

I assume the problem here is ObjC property syntax, which usually looks like
“foo.prop” where foo has ObjC pointer type.  Type-checking a property access
really does require the type to be complete.  However, pseudo-destructor calls
are not property accesses, and should not require the pointee type to be
complete.

We already accept the pseudo-destructor call if the interface type is complete,
presumably without actually looking anything up in the interface.  We just
unnecessarily bail out early if the interface is incomplete, despite it being a
pseudo-destructor call."

-- 
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/20141002/53774db6/attachment.html>


More information about the llvm-bugs mailing list