llvm / llvm/llvm-project

[libc++] Fix handling iterators with proxy subscript in heap algorithms

Open
#176,862 1 comment 0 reactions 0 assignees View on GitHub
libc++
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Recently, libstdc++ fixed the issue of directly using proxy subscripts in algorithms: https://github.com/gcc-mirror/gcc/commit/76ad28b11266606fcc1571d0ef92d3f2ef402bfb

libc++ seems to have a similar issue:
https://github.com/llvm/llvm-project/blob/7dc2cd4c6840f0c3eeca4d822709a7605836d000/libcxx/include/__algorithm/sift_down.h#L48

However, since this problem is so corner, i.e., I have basically never seen an iterator that does not return a `reference` in `operator[]`. Do we need to fix this?

Contributor guide

Open the contributing guide

Research direction

Start by reading libcxx/include/__algorithm/sift_down.h around line 48 and comparing its proxy-subscript handling with the linked libstdc++ commit. Confirm whether the reported iterator case affects libc++ heap algorithms; done means reaching a justified decision about fixing it and documenting or testing that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.