| Issue |
52857
|
| Summary |
Lambdas cannot be used inside c++20 modules because they share the “definition with same mangled name”
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ruoka
|
**How to reproduce:**
```cpp
// module.cpp
export module test;
export namespace test
{
auto foo = [] {return 1;};
auto bar = [] {return 'a';};
}
// main.cpp
import test;
int main()
{
test::foo();
test::bar();
}
```
$ clang++ -std=c++20 -fprebuilt-module-path=. -Xclang -emit-module-interface -c module.cpp -o test.pcm
$ clang++ -std=c++20 -fprebuilt-module-path=. main.cpp test.pcm -o main
In file included from main.cpp:1:
./module.cpp:6:16: error: definition with same mangled name '_ZW4testENK4testUt_clEv' as another definition
auto bar = [] {return 'a';};
^
./module.cpp:5:16: note: previous definition is here
auto foo = [] {return 1;};
^
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs