================ @@ -7337,6 +7337,27 @@ static void handleDeclspecThreadAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(::new (S.Context) ThreadAttr(S.Context, AL)); } +static void handleMSConstexprAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (!S.getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2022_3)) { + S.Diag(AL.getLoc(), diag::warn_unknown_attribute_ignored) + << AL << AL.getRange(); + return; + } + auto *FD = cast<FunctionDecl>(D); + if (FD->isConstexprSpecified() || FD->isConsteval()) { + S.Diag(AL.getLoc(), diag::err_ms_constexpr_not_distinct) + << FD->isConsteval() << FD; + return; + } + if (auto *MD = dyn_cast<CXXMethodDecl>(FD)) { ---------------- RIscRIpt wrote:
Prior to C++20 `constexpr` functions were not allowed to be `virtual` [cppreference](https://en.cppreference.com/w/cpp/language/constexpr). I know this is an attribute, but this matches MSVC behavior: https://godbolt.org/z/snn6c1EW7 https://github.com/llvm/llvm-project/pull/71300 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits