cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[cpp.predefined] `__cpp_user_defined_literals` should be pushed to `__cpp_nontype_template_args` #508

Open Eisenwave opened 4 months ago

Eisenwave commented 4 months ago

Reference (section label): [cpp.predefined]

Issue description

P0732 introduced class type non-type template parameters for C++20. As a "drive-by feature", this proposal has made changes to user-defined literals.

However, __cpp_user_defined_literals is presently defined as 200809L (C++11). This makes feature-detection of string literal operator templates more obscure.

Suggested resolution

In subclause 15.11 [cpp.predefined], update Table 22 [tab:cpp.predefined.ft] as follows:

-__cpp_user_defined_literals 200809L
+__cpp_user_defined_literals 201806L

Note

201806L is taken from https://wg21.link/sd6.

beached commented 4 months ago

As per P0732, it doesn't look like (checked with gh search on clang/gcc codebases) the feature flag __cpp_nontype_template_parameter_class was implemented either

jensmaurer commented 4 months ago

Yup, that doesn't exist. The paper hid this under "Remarks":

We propose the feature test macro name __cpp_nontype_template_parameter_class for this feature.

so the editors overlooked it when they applied the paper.

Can someone make a pull request adding that feature-test macro (only), as an editorial oversight?

The concern here about user-defined literals is different, because it wasn't mentioned in the paper.

Eisenwave commented 4 months ago

Can someone make a pull request adding that feature-test macro (only), as an editorial oversight?

Sure, I can make a PR

Update

Everything seems to be in order. P1907R1: Inconsistencies with non-type template parameters removed __cpp_nontype_template_parameter_class and bumped __cpp_nontype_template_args.

See also https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations

jensmaurer commented 4 months ago

Ok, so coming back from the detour, this is a request to bump __cpp_user_defined_literals because the accepted P0732 make changes to those, too.

For SG10 to decide, I'd say.

Eisenwave commented 4 months ago

For SG10 to decide, I'd say.

So, should I refile this issue somewhere else or can we at least keep the issue here? Sorry if I've messed this up; I'm not entirely familiar with the committee structure yet.

cpplearner commented 4 months ago

For SG10 to decide, I'd say.

So, should I refile this issue somewhere else or can we at least keep the issue here? Sorry if I've messed this up; I'm not entirely familiar with the committee structure yet.

No need to refile. @jensmaurer has sent a mail to SG10's mailing list (see https://lists.isocpp.org/sg10/2024/02/0860.php).