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

Hans Wennborg hans at chromium.org
Wed May 28 12:00:03 PDT 2014


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".



More information about the cfe-commits mailing list