MitalAshok requested changes to this revision. MitalAshok added a comment. This revision now requires changes to proceed.
This does currently break `namespace foo { inline namespace std {} }`, `namespace foo::inline std {}`, etc. ================ Comment at: clang/lib/Sema/SemaDeclCXX.cpp:11369 + // This has to be diagnosed before entering DiagnoseNamespaceInlineMismatch. + if (IsInline && II->isStr("std")) + Diag(InlineLoc, diag::err_inline_namespace_std) ---------------- You need to check if this is a std namespace declaration at file scope, `namespace foo::inline std {}` in a namespace scope should be fine. The check for this is a few lines below: `CurContext->getRedeclContext()->isTranslationUnit()`. ================ Comment at: clang/lib/Sema/SemaDeclCXX.cpp:11393-11394 if (IsInline != PrevNS->isInline()) DiagnoseNamespaceInlineMismatch(*this, NamespaceLoc, Loc, II, &IsInline, PrevNS); } else if (PrevDecl) { ---------------- This ends up giving two errors on the same line if this wasn't the first declaration (`error: namespace 'std' cannot be declared inline` followed by `error: non-inline namespace cannot be reopened as inline; note: previous definition is here`). The wording for the second error is also a little confusing (it cannot be opened at all as inline, let alone reopened), so consider refactoring so that both diagnostics can't be issued at once Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156063/new/ https://reviews.llvm.org/D156063 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits