Fix crash with UniqueExternalLinkage in extern "C" contexts

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Mar 11 19:01:36 PDT 2013


On 11 March 2013 21:02, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> Clang currently hits the assert in GetGVALinkageForVariable when compiling
>
> namespace {
>   struct X {};
> }
> extern "C" {
>   X b = X();
> }
>
> The attached patch fixes it by propagating the linkage to variables,
> even if they are extern "C". This seems consistent with how we handle
> other interactions of language linkage and non-external linkage.

Sorry. Reading [basic.link] again I now think that the assert is just
bogus. The standard talks about entities with C language linkage (and
therefore external linkage) whose type has no linkage. It is
reasonable to also accept types that have non-external linkage.

The attached patch fixes it.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 1369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130311/79858966/attachment.obj>


More information about the cfe-commits mailing list