[PATCH] Sema: Propagate the mangling number into instantiations

David Majnemer david.majnemer at gmail.com
Sun Nov 17 18:52:39 PST 2013


Your example doesn't compile for me.

Lambdas in contexts where they would be instantiated should have their
surrounding declaration context mangled in as part of their external name
(template args, etc.), I am left a bit confused as to where we would need
to avoid propagating the mangling number.

What about the bodies of these lambdas? I don't see why it wouldn't be fine
for the bodies of the lambdas to have the same mangling number.


On Sun, Nov 17, 2013 at 5:21 PM, Richard Smith <richard at metafoo.co.uk>wrote:

>
>   Does this do the right thing in the context of variadic template pack
> expansions? For lambda expressions, we deliberately do not inherit the
> mangling number because that would not be correct:
>
>     template<typename ...Ts> void f(std::function<T()> ...fn = []{ return
> T(); }) {}
>
>   ... would give all the instantiated lambdas the same mangling number,
> for instance.
>
>   What we do for lambdas is to compute the mangling number during
> instantiation in the same way we compute it during parsing.
>
> http://llvm-reviews.chandlerc.com/D2203
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131117/9ca34f5c/attachment.html>


More information about the cfe-commits mailing list