llvm / llvm/llvm-project

clang incorrectly accepts constexpr array indexing of null pointer

Open
#201,683 5 comments 1 reaction 0 assignees View on GitHub
clang:frontend confirmed constexpr
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Consider the following in C++:

```c++
constexpr int *x = &((int*)nullptr)[0];
```

This is dereferencing a null pointer, I think, but there is no "dereferencing a null pointer" diagnostic like we'd get with "*".

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.