[PATCH] Sema: Functions with dll attributes cannot be deleted

Hans Wennborg hans at chromium.org
Wed May 28 13:53:21 PDT 2014


On Wed, May 28, 2014 at 1:49 PM, Nico Rieck <nico.rieck at gmail.com> wrote:
> On 28.05.2014 21:00, Hans Wennborg wrote:
>> On Tue, May 27, 2014 at 7:53 PM, Nico Rieck <nico.rieck at gmail.com> wrote:
>>>
>>
>> This sounds reasonable, but MSVC doesn't seem to diagnose it. It seems
>> to happily compile the following:
>>
>>   struct S {
>>     void __declspec(dllexport) foo() = delete;
>>     void __declspec(dllexport) bar() {}
>>   };
>>
>> exporting bar(), but not foo(). My (pretty old unfortunately) MinGW
>> didn't error either.
>
> IMO this is a missed diagnostic by the other compilers because deleting
> non-member functions with dll attributes *is* diagnosed. Note that this
> doesn't fire if the class itself has the attribute. But if folks feel
> strongly about it I can exclude member functions.

Aha, I never tested it with free functions. Yes, this seems like the
right thing to do.

Patch LGTM.

Thanks,
Hans



More information about the cfe-commits mailing list