================
@@ -12400,12 +12400,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S,
FunctionDecl *NewFD,
void Sema::CheckMain(FunctionDecl *FD, const DeclSpec &DS) {
// [basic.start.main]p3
- // The main function shall not be declared with a linkage-specification.
- if (FD->isExternCContext() ||
- (FD->isExternCXXContext() &&
- FD->getDeclContext()->getRedeclContext()->isTranslationUnit()))
- Diag(FD->getLocation(), diag::ext_main_invalid_linkage_specification)
- << FD->getLanguageLinkage();
+ // The main function shall not be declared with C linkage-specification.
+ if (FD->isExternCContext())
+ Diag(FD->getLocation(), diag::ext_main_invalid_linkage_specification);
----------------
ashwinbanwari wrote:
According to proposal, `extern "C"` for main is still ill-formed regardless if
it is named module or not. On other hand, `extern "C++"` is allowed whether in
named module or not.
https://github.com/llvm/llvm-project/pull/146461
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits