[clang-tools-extra] [clang-tidy] Fix false positive in `bugprone-std-namespace-modification` when opening subnamespaces of `std::` (PR #174170)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 2 00:10:31 PST 2026


vbvictor wrote:

I think we should strictly follow "allowed cases" from https://en.cppreference.com/w/cpp/language/extending_std.html, which include some modifications of `ranges` but say nothing about `chrono`.

> It is undefined behavior to add declarations or definitions to namespace std or to any namespace nested within std, with a few exceptions noted below.

I can't imagine why someone would just open std namespace without any declarations in it - this is still worth diagnosing imho.

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


More information about the cfe-commits mailing list