[PR C++ 94426] Lambda linkage

Nathan Sidwell nathan@acm.org
Fri Apr 10 18:08:49 GMT 2020


My fix for 94147 was confusing no-linkage with internal linkage, at the 
language level.  That's wrong. (the std is confusing here, because it 
describes linkage of names (which is wrong), and lambdas have no names)

Lambdas with extra-scope, have linkage.  However, at the 
implementation-level that linkage is at least as restricted as the 
linkage of the extra-scope decl.

Further, when instantiating a variable initialized by a lambda, we must 
determine the visibility of the variable itself, before instantiating 
its initializer.  If the template arguments are internal (or 
no-linkage), the variable will have internal linkage, regardless of the 
linkage of the template it is instantiated from.  We need to know that 
before instantiating the lambda, so we can restrict its linkage correctly.

I'll commit this in a few days.

nathan
-- 
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr94426.diff
Type: text/x-patch
Size: 8356 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200410/8cf011fd/attachment-0001.bin>


More information about the Gcc-patches mailing list