This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4488. Undesired status for some functions in <cmath>

Section: 16.4.2.3 [headers] Status: New Submitter: Jiang An Opened: 2025-12-08 Last modified: 2025-12-19

Priority: Not Prioritized

View all other issues in [headers].

View all issues with New status.

Discussion:

Originally reported in cplusplus/draft#8579.

Currently, 16.4.2.3 [headers] p5 specially mentions "except for names which are defined as macros in C", which covers std::fpclassify and its friends. Perhaps we don't want to require them to be initially declared in namespace std. Moreover, 16.4.2.3 [headers] p6 seemingly requires them to be also defined as macros in C++, which doesn't seem intentional.

Perhaps we want to exactly specify whether a name denotes a function (overload set) or a macro in C++, while no name should denote both a function and a macro, and to allow a function name from C initially declared in the global namespace.

Proposed resolution:

This wording is relative to N5032.

  1. Modify 16.4.2.3 [headers] as indicated:

    […]

    -5- Except as noted in 16 [library] through 33 [exec] and D [depr], the contents of each header cname is the same as that of the corresponding header name.h as specified in the C standard library (2 [intro.refs]). In the C++ standard library, however, the declarations (except for names which are defined as macros in C++) are within namespace scope (6.4.6 [basic.scope.namespace]) of the namespace std. It is unspecified whether these names (including any overloads added in 17 [support] through 33 [exec] and D [depr]) are first declared within the global namespace scope and are then injected into namespace std by explicit using-declarations (9.10 [namespace.udecl]).

    -6- Names which are defined as macros in C shall be defined as macros in the C++ standard librarythe C++ standard library shall not be defined as functions, even if C grants license for implementation as functions. [Note 2: The names defined as macros in C include the following: assert, offsetof, setjmp, va_arg, va_end, and va_start. — end note]

    -7- Names that are defined as functions in C shall be defined as functions in the C++ standard librarythe C++ standard library shall not be defined as macros.(138)