[PATCH] D145271: [MSVC compatibility][DLLEXPORT/DLLIMPORT] Allow dllexport/dllimport for local classes

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 11:03:03 PST 2023


wolfgangp added a comment.

> It still seems like the export/import there is an accident since `Base<f::Local>` can't really be referenced from outside the file anyway.
>
> Perhaps rather than giving `Base<f::Local>` external linkage to allow it to be imported/exported, the better fix would be to drop its dllimport/export attribute when instantiated with a local type?

I like it. However, we would then not match MSVC's behavior in generating external definitions for the class (useless as they are). I suppose that's OK.

But on another note, would we then abandon matching MSVC on the following?

  void func() {
    class __declspec(dllexport) A {
    };
  }

This is currently accepted by MSVC, though arguably much less defensible than the above example.


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

https://reviews.llvm.org/D145271



More information about the llvm-commits mailing list