[LLVMbugs] [Bug 16231] New: Clang compiles block in .cpp file instead of generating a compilation error
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Wed Jun  5 01:07:20 PDT 2013
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=16231
            Bug ID: 16231
           Summary: Clang compiles block in .cpp file instead of
                    generating a compilation error
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: konevaanna2012 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified
I have installed the latest version of XCode 4.6.2. Imagine there is a code
sample like below.
In one project I have 3 similar classes that use blocks. One is an Objective-C:
TestClass1.h:
@interface TestClass1 : NSObject
- (void)test;
@end
TestClass1.m:
@implementation TestClass1
- (void)test
{
    void (^d_block)(void) =
    ^{
        int n;
    };
}
@end
One is in C++ (in the same project):
TestClass2.h:
class TestClass2
{
public:
    void TestIt();
};
TestClass2.cpp:
void TestClass2::TestIt()
{
    void (^d_block)(void) =
    ^{
        int n;
    };
}
One is in Objective-C++ (in the same project):
TestClass3.h:
class TestClass3
{
public:
    void TestIt();
};
TestClass3.mm:
void TestClass3::TestIt()
{
    void (^d_block)(void) =
    ^{
        int n;
    };
}
Clang compiles all these 3 classes successfully but blocks are the Objective-C
feature. It seems to me that the compiler should generate an error message in
.cpp file case. Is it a bug? Or maybe I don't understand something...
-- 
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/20130605/dc7c4712/attachment.html>
    
    
More information about the llvm-bugs
mailing list