[PATCH] D65511: Delay emitting dllexport explicitly defaulted members until the class is fully parsed (PR40006)

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 31 10:03:11 PDT 2019


hans marked an inline comment as done.
hans added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:11545
+    for (CXXMethodDecl *M : WorkList) {
+      DefineImplicitSpecialMember(*this, M, M->getLocation());
+      ActOnFinishInlineFunctionDef(M);
----------------
rnk wrote:
> Do we need to do this until fixpoint? Suppose a dllexported implicit special member triggers a template instantiation, and the template has a dllexported defaulted special member, something like:
> ```
> struct Bar { Bar(); };
> template <typename T> struct Foo { __declspec(dllexport) Foo() = default; Bar obj; };
> struct Baz {
>    ... not sure how to trigger instantiation
> };
> ```
I think that should work, and that's why the function is written to be re-entrant by having a local worklist. If it triggers a template instantiation, ActOnFinishCXXNonNestedClass should get called for the newly instantiated class. But I'm also not sure how to write a test case that would trigger it.


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

https://reviews.llvm.org/D65511





More information about the cfe-commits mailing list