[LLVMbugs] [Bug 7865] New: error: indirection to an interface is not supported ('NSOperationQueue' invalid)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 10 12:04:07 PDT 2010


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

           Summary: error: indirection to an interface is not supported
                    ('NSOperationQueue' invalid)
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: james at markzware.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following Objc++ code isn't a proper use of boost::call_once, but gcc
compiles it and I can't come up with a valid reason why clang shouldn't as
well. Though the logic is questionable, I don't think the code is actually
invalid. I'll submit this case for analysis.


#include <Cocoa/Cocoa.h>


#include <boost/thread/once.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>


void deleteObject(void *anObjectPtr)
{
    NSObject *tmpObjectPtr = (NSObject *)anObjectPtr;
    [tmpObjectPtr release];
}

static NSOperationQueue& throttlingQueue_() throw(std::exception&)
{
    static boost::shared_ptr<NSOperationQueue> statTaskQueueSPtr;

    if(statTaskQueueSPtr.get() == NULL)
    {
        statTaskQueueSPtr.reset([[NSOperationQueue alloc] init], deleteObject);

        [statTaskQueueSPtr.get() setMaxConcurrentOperationCount:1]; 
        [statTaskQueueSPtr.get() setSuspended:true];
    }

    return *statTaskQueueSPtr;
}

NSOperationQueue& throttlingQueue() throw(std::exception&)
{
    static boost::once_flag tmpOneTimeRunSentinal = BOOST_ONCE_INIT;
    boost::call_once(tmpOneTimeRunSentinal, throttlingQueue_);

    return throttlingQueue_();
}


int main (int argc, char * const argv[]) 
{
    NSOperationQueue& tmpThrottlingQueue = throttlingQueue();

    return 0;
}

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