clang 1.5 forces linkage to C++ for non-C++ source file

Number:rdar://8230225 Date Originated:23-Jul-2010 08:22 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 3.2.3
Classification:Serious Bug Reproducible:Always
The popular RegExKitLite open source project apparently exposes a bug in clang 1.5 causing it to apply the C++ personality to the source file, even though C++ is not specified on that command line, and even though the source file in question does not contain C++ code.

The attached sample project exercises the problem, just open and build to observe that RegExKitLite.m is compiled using an objective-C flavor command-line invocation of clang, but that the resulting .o file ends up referencing stdc++ symbols.

This is a problem for anybody who is using Clang LLVM to compile RegExKitLite. I don't know of any workaround short of linking with stdc++, which is a pretty undesirable concession to make in an otherwise C++ free project.

The current top-of-trunk clang builds from the open source svn repository do not exhibit this bug.

See also my blog post on the subject:


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!