Issue |
133981
|
Summary |
-Wundefined-inline and linking issue
|
Labels |
|
Assignees |
|
Reporter |
boguscoder
|
```
void foo() {
auto lambda = [](auto&& unused) {
struct Test {
Test(...) {}
~Test() {}
} test;
};
lambda(42);
}
template <typename ... T>
void fooT() {
auto lambda = [](auto&& unused) {
struct Test {
Test(...) {}
~Test() {}
} test;
};
lambda(42);
}
int main() {
foo();
fooT<int, char, double>();
return 0;
}
```
yields
```
<source>:15:9: warning: inline function 'fooT()::(anonymous class)::operator()(int &&)::Test::Test' is not defined [-Wundefined-inline]
15 | Test(...) {}
| ^
<source>:17:9: note: used here
17 | } test;
| ^
<source>:16:9: warning: inline function 'fooT()::(anonymous class)::operator()(int &&)::Test::~Test' is not defined [-Wundefined-inline]
16 | ~Test() {}
| ^
<source>:17:9: note: used here
17 | } test;
| ^
2 warnings generated.
ASM generation compiler returned: 0
<source>:15:9: warning: inline function 'fooT()::(anonymous class)::operator()(int &&)::Test::Test' is not defined [-Wundefined-inline]
15 | Test(...) {}
| ^
<source>:17:9: note: used here
17 | } test;
| ^
<source>:16:9: warning: inline function 'fooT()::(anonymous class)::operator()(int &&)::Test::~Test' is not defined [-Wundefined-inline]
16 | ~Test() {}
| ^
<source>:17:9: note: used here
17 | } test;
```
Link https://godbolt.org/z/8ef585x3x
This does work in trunk gcc and msvc.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs