[PATCH] D135154: Keep inherited dllimport/export attrs for explicit specialization of template class member functions

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 5 03:54:48 PDT 2022


hans added a comment.

This did turn up a problem.

With this patch Clang treats the following (based on https://source.chromium.org/chromium/chromium/src/+/main:media/formats/hls/source_string.h;l=125) as invalid, and so does MSVC:

  template <typename> struct __declspec(dllexport) Foo {
      static Foo create();
  };
  
  // Don't allow creating Foo's of ints.
  template <> Foo<int> Foo<int>::create() = delete; // MSVC: attempting to delete a __declspec(dllexport) function

The dllimport case errors similarly.

I'm tempted to make Clang keep allowing this. The intent of the code is perfectly clear -- the user is trying to delete the function, not export/import it -- and I can't think of any good way for the user to work around the error.

(Besides this issue, at least Chromium builds cleanly with this patch.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135154/new/

https://reviews.llvm.org/D135154



More information about the cfe-commits mailing list