Issue 131611
Summary [Clang][Windows] Microsoft mangling cannot handle lambda in decltype in return type
Labels clang
Assignees
Reporter MagentaTreehouse
    Given this code:
```c++
template <class>
struct B {};

struct A {
 template <class T>
    auto f(T) -> B<decltype([] (T) {})> {
        return {};
    }
};

int main() {
    A{}.f(0);
}
```

Clang on Windows error:
```console
<source>(6,5): error: cannot mangle this template specialization type yet
    6 |     auto f(T) -> B<decltype([] (T) {})> {
 |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    7 |         return {};
 |         ~~~~~~~~~~
    8 |     }
      |     ~
```

Similar error happens on simpler code:
```c++
template <class T> // must be a function template
auto f(T) -> decltype([] {}) {
    return {};
}
int main() { f(0)(); }
```

On other platforms with Itanium mangling, or if using MSVC, it can be compiled.

See https://compiler-explorer.com/z/vPz6E5ve7. (Compiler explorer seems to only have version 18 for `clang-cl`)

I can reproduce this using the main branch.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to