================ @@ -924,6 +939,23 @@ static bool checkExportedDeclContext(Sema &S, DeclContext *DC, /// Check that it's valid to export \p D. static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) { + // HLSL: export declaration is valid only on functions + if (S.getLangOpts().HLSL) { + auto *FD = dyn_cast<FunctionDecl>(D); + if (!FD) { + if (auto *ED2 = dyn_cast<ExportDecl>(D)) { + S.Diag(ED2->getBeginLoc(), diag::err_export_within_export); + if (auto *ED1 = dyn_cast<ExportDecl>(D->getDeclContext())) + S.Diag(ED1->getBeginLoc(), diag::note_export); + } ---------------- hekota wrote:
Good catch! https://github.com/llvm/llvm-project/pull/96823 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits