[PATCH] Sema: Require external linkage for dllimport/dllexport attributes

Richard Smith richard at metafoo.co.uk
Wed Mar 26 19:16:53 PDT 2014


On 26 Mar 2014 11:09, "Reid Kleckner" <rnk at google.com> wrote:
>
> LGTM
>
> On Wed, Mar 26, 2014 at 9:28 AM, Nico Rieck <nico.rieck at gmail.com> wrote:
>>
>> Both attributes require external linkage. This is not fully compatible
>> with MSVC because MSVC allows exporting/importing from anonymous
>> namespaces. But until we can mangle this properly this should not be
>> allowed.
>
>
> Yeah, I don't think we should support exporting/importing from anonymous
namespaces.  They have external language linkage, but really they aren't
externally visible and can't be imported/exported.  =P

In C++11 onwards they have internal linkage, even.

> ....
> +
> +#if __has_feature(cxx_auto_type)
>
> Any reason for this #if?  The test only uses c++11 and c++1y.
>
> +__declspec(dllexport) auto InternalAutoTypeGlobal = Internal(); //
expected-error{{'InternalAutoTypeGlobal' must have external linkage when
declared 'dllexport'}}
> +__declspec(dllexport) auto ExternalAutoTypeGlobal = External();
> +#endif
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140326/3ae27bc5/attachment.html>


More information about the cfe-commits mailing list