This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-10-11


3086. Destringizing should consider all sorts of encoding-prefixes

Section: 15.13  [cpp.pragma.op]     Status: open     Submitter: US     Date: 2025-10-01

N5028 comment US 60-110

Subclause 15.13 [cpp.pragma.op] paragraph 1 specifies:

A unary operator expression of the form:
  _Pragma ( string-literal )
is processed as follows: The string-literal is destringized by deleting the L prefix, if present, deleting the leading and trailing double-quotes, replacing each escape sequence \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The resulting sequence of characters is processed through translation phase 3 to produce preprocessing tokens that are executed as if they were the pp-tokens in a pragma directive. The original four preprocessing tokens in the unary operator expression are removed.

The destringizing does not, but should, consider encoding-prefixes other than L.

See also C23 6.10.11.

Possible resolution:

Change in 15.13 [cpp.pragma.op] paragraph 1 as follows:

A unary operator expression of the form: form
  _Pragma ( string-literal )
is processed as follows: The string-literal is destringized by deleting the L prefix, if present any encoding-prefix, deleting the leading and trailing double-quotes, replacing each escape sequence \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The resulting sequence of characters is processed through translation phase 3 to produce preprocessing tokens that are executed as if they were the pp-tokens in a pragma directive. The original four preprocessing tokens in the unary operator expression are removed.