[cfe-dev] [PATCH] PCH Support for C++ decls

Andrew Sutton andrew.n.sutton at gmail.com
Thu Mar 4 08:23:22 PST 2010


> Aside: anonymous namespaces are somewhat interesting for PCH, because we
> need to make sure that an anonymous namespace defined in the source file
> gets linked to an anonymous namespace defined in the PCH file, since they
> are effectively the same anonymous namespace. One fun way to test this is:
>
>  // In PCH:
>  namespace {
>    class X;
>  }
>
>  // In source file (that includes PCH):
>  namespace {
>    class X;
>  }
>
>  X *x; // okay, but will likely fail with an ambiguity if the two anonymous
> namespaces don't get linked.
>

Just a quick update/observation on this point. It looks like this was easily
solved by making sure that the TU serializes its anonymous namespace, which
it wasn't. I've fixed this in the patch that I'll probably push tomorrow. I
need to write some more tests for classes.

Andrew Sutton
andrew.n.sutton at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100304/0be81161/attachment.html>


More information about the cfe-dev mailing list