llvm / llvm/llvm-project

auto allowed with a type in C++

Open
#164,273 13 comments 0 reactions 0 assignees View on GitHub
clang:frontend diverges-from:edg diverges-from:gcc diverges-from:msvc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

We currently allow something like this in C++: https://godbolt.org/z/7fabbGfe6

```cpp
void f() {
auto int x = 1;
}
```

It looks like this was allowed as an extension in C++ because it was valid C but I don't think it makes sense to support this anymore.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `auto int x = 1` example from the Godbolt link in the C++ compiler. Trace where this construct is accepted and look for the relevant compiler tests; done means the construct is rejected in C++ while the existing C behavior remains covered.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.