llvm / llvm/llvm-project

return-type deduction failure for lambda inside decltype.

Open
#168,249 1 comment 0 reactions 0 assignees View on GitHub
clang:frontend diverges-from:gcc lambda
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

This fails to compile on clang-trunk.
```cpp
template
using X = decltype(
[]{
if constexpr(I == 0)
return int{};
else
return char{};
}()
);

template
inline constexpr auto Y = X{};

static_assert(Y<1> == char{});
```
Need to inject a template-param () for it to work.

Works on gcc. Godbolt: https://godbolt.org/z/3Ydv8b866.

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.