[clang] [Clang] Ensure child classes export inherited constructors from base classes (PR #182706)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 23 22:09:31 PST 2026


================
@@ -6588,6 +6594,19 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
   // Force declaration of implicit members so they can inherit the attribute.
   ForceDeclarationOfImplicitMembers(Class);
 
+  // Inherited constructors are created lazily; force their creation now so the
+  // loop below can propagate the DLL attribute to them.
+  if (ClassExported) {
+    SmallVector<ConstructorUsingShadowDecl *, 4> Shadows;
+    for (auto *D : Class->decls())
+      if (auto *S = dyn_cast<ConstructorUsingShadowDecl>(D))
----------------
ojhunt wrote:

auto here is ok under llvm code standards because a reader can see the actual type in the `dyn_cast`

https://github.com/llvm/llvm-project/pull/182706


More information about the cfe-commits mailing list