llvm / llvm/llvm-project

Non-portable test for `iter_difference_t<raw_storage_iterator<I, T>>`

Open
#170,763 0 comments 0 reactions 0 assignees View on GitHub
libc++ test-suite
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://github.com/llvm/llvm-project/blob/47de55f28438a4a3c3c96157fba66694587d8040/libcxx/test/std/utilities/memory/storage.iterator/types.compile.pass.cpp#L27-L29

In libc++ `raw_storage_iterator` has a non-void `difference_type` in C++20 and later, which is a conforming extension because `raw_storage_iterator` was deprecated in C++17 and removed from C++20, so you can define it however you want.

But the test that checks for that non-standard extension is not portable to other implementations:

```
# | /home/jwakely/src/llvm/llvm-project/libcxx/test/std/utilities/memory/storage.iterator/types.compile.pass.cpp:28:66: error: static assertion failed
# | 28 | static_assert(std::is_same::value, "");
# | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
```

This fails with libstdc++.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.