cplusplus / cplusplus/draft

[expr.shift] p1 What is the promoted type of a source type to which integral promotion does not apply?

Open
#5,398 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

[expr.shift] p1 says

The operands shall be of integral or unscoped enumeration type and integral promotions are performed. The type of the result is that of the promoted left operand.

Consider this example:

long int i = 0;
i << 1;  

The left operand's type is long int whose integer conversion rank is greater than int, thus [conv.prom] p1 cannot apply to such a type, as per the following:

A prvalue of an integer type other than bool, char8_­t, char16_­t, char32_­t, or wchar_­t whose integer conversion rank ([conv.rank]) is less than the rank of int can be converted to a prvalue of type int...

So, what is the promoted type if the integral promotion does not apply at all? Shall we improve [expr.shift] p1 to the following to clarify this vague?

The operands shall be of integral or unscoped enumeration type and integral promotions are performed(if necessary). The type of the result is that of the possibly promoted left operand.

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.

Research direction

Start with [expr.shift] p1 and [conv.prom] p1, using the long int example to verify how the wording applies when no promotion changes the type. Done means resolving whether the existing text is sufficiently precise or adopting wording that clearly covers an unpromoted operand.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.