[LLVMbugs] [Bug 11303] New: Objective - C - instance method "copyWithZone" being allowed to be invoked using a non-root class object

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 3 18:06:36 PDT 2011


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

             Bug #: 11303
           Summary: Objective - C - instance method "copyWithZone" being
                    allowed to be invoked using a non-root class object
           Product: new-bugs
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: muthuveerappan.al at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7573
  --> http://llvm.org/bugs/attachment.cgi?id=7573
example showing that the instance method "copyWithZone" is allowed to be
invoked using a non-root class object

Overview
==============
copyWithZone is an instance method belonging to the protocol NSCopying with the
following spec:
- (id)copyWithZone:(NSZone *)zone
Non-root class objects shouldn't be allowed to invoke instance methods

Actual Behavior:
=============
Invoking an instance method "copyWithZone" with non-root class object doesn't
throw a compiler warning / error

Expected Behavior:
===============
Invoking an instance method copyWithZone with non-root class object should
throw a compiler warning / error

Documentation reference:
===================
Document - The Objective-‐C Programming Language (page 32)

"The only instance methods that a class object can perform are those defined in
the root class, and only if there’s no class method that can do the job."

Example: (attached below shows the problem)
===================================
To replicate a similar environment I have created a protocol P1 with an
instance method f1
class "A" is a non-root class, it inherits from NSObject, when the class object
of "A" tries to invoke f1, the compiler throws an error as expected.
When class object of "A" invokes "copyWithZone", no compilation warning / error
is thrown

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