llvm / llvm/llvm-project

[clang] Rejects valid deducing return type with expansion statement

Open
#212,086 12 comments 0 reactions 1 assignee Claimed by @Sirraide View on GitHub
c++26 clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://godbolt.org/z/zcE5TbKzn

```c++
auto f() {
template for (auto x : {}) {
return 3;
}
return 1.3;
}
```

```
:5:3: error: 'auto' in return type deduced as 'double' here but deduced as 'int' in earlier return statement
5 | return 1.3;
| ^
1 error generated.
```

This should be valid because after expansion the function only contains one "return".

CC @Sirraide

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.