Title
Possible expansions of __LINE__ changing over time
Status
open
Section
15.12 [cpp.predefined]
Submitter
Jaing An

Created on 2025-12-05.00:00:00 last changed 7 days ago

Messages

Date: 2025-12-05.00:00:00

(From submission #826.)

__LINE__ is specified in 15.12 [cpp.predefined] paragraph 1 as:

The presumed line number (within the current source file) of the current source line (an integer literal).

The spelling of a literal is observable through stringizing (15.7.3 [cpp.stringize]). Furthmore, the set of possible spellings for a literal of a given integer value has expanded over time; for example digit separators and binary integer literals are permitted since C++14.

A program that relies on a particular spelling of an integer literal expanded from __LINE__ might thus break.

We could either add an Annex C entry for this breakage in C++14, or specify that __LINE__ always yields a decimal integer literal with no digit separators.

History
Date User Action Args
2025-12-05 00:00:00admincreate