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

Richard Smith richard at metafoo.co.uk
Wed May 28 19:50:15 PDT 2014


On Wed, May 28, 2014 at 12:00 PM, Hans Wennborg <hans at chromium.org> 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.
>
> > --- a/include/clang/Basic/DiagnosticSemaKinds.td
> > +++ b/include/clang/Basic/DiagnosticSemaKinds.td
> > @@ -2093,6 +2093,8 @@ def err_attribute_dll_redeclaration : Error<
> >    "redeclaration of %q0 cannot add %q1 attribute">;
> >  def err_attribute_dllimport_function_definition : Error<
> >    "dllimport cannot be applied to non-inline function definition">;
> > +def err_attribute_dll_deleted : Error<
> > +  "attempt to delete %q0 function">;
>
> I think "cannot" diagnostics are more common in Clang. How about
> "cannot delete %q0 function".


We'd usually phrase this the other way around:

  "attribute 'dllexport' cannot be applied to a deleted function"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140528/9e392b75/attachment.html>


More information about the cfe-commits mailing list