<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang compiles block in .cpp file instead of generating a compilation error"
   href="http://llvm.org/bugs/show_bug.cgi?id=16231">16231</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang compiles block in .cpp file instead of generating a compilation error
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>konevaanna2012@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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...</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>