decltype(auto) deduces a different type than decltype for captured C++ variables in Objective-C++ blocks
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The following program fails to compile because the static_assert triggers (https://godbolt.org/z/59neq4a4a):
```objc++
template
inline constexpr bool is_same_as = false;
template
inline constexpr bool is_same_as = true;
struct X {};
void f() {
X x;
void (^b)(void) = ^{
decltype(auto) y = (x);
static_assert(is_same_as);
};
}
```
Contributor guide
Research direction
Start by reproducing the Objective-C++ example from the issue in the linked Godbolt compiler explorer. Trace how decltype(auto) initialization and decltype handle the captured variable inside the block, then verify that the static_assert comparing decltype(y) with decltype((x)) passes without changing the reproducer's intended semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, objective-c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100