cplusplus / cplusplus/draft

[namespace.std] Reopening a namespace within `std`

Open
#8,714 9 comments 0 reactions 1 assignee View on GitHub

@jwakely is already working on this.

Since Jan 29, 2026.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

Is the following example well-defined?

#include <ranges>

class MyClass;

namespace std::ranges {
  template<>
  inline constexpr bool disable_sized_range<MyClass> = true;
}

It seemingly violates [namespace.std]/1 by defining the ranges namespace in std. I guess an LWG issue would be needed if we want to allow it.

If we want to keep it disallowed, perhaps it would be helpful to add an example with correction.

E.g.

#include <ranges>

class MyClass;

namespace std::ranges { // undefined behavior (or ill-formed, no diagnostic required): defining a namespace in std
  template<>
  inline constexpr bool disable_sized_range<MyClass> = true;
}

template<>
inline constexpr bool std::ranges::disable_sized_range<MyClass> = true; // OK

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.