-
Couldn't load subscription status.
- Fork 15k
Closed
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.constexprAnything related to constant evaluationAnything related to constant evaluationlambdaC++11 lambda expressionsC++11 lambda expressions
Description
template <class>
constexpr auto f{[] (auto) {
struct OnScopeExit { ~OnScopeExit() {} }
pending;
}};
int main() {
f<int>(0);
}See https://compiler-explorer.com/z/6vneqf93z.
Warning and linker error since Clang 15:
<source>:3:26: warning: inline function '(anonymous class)::operator()(int)::OnScopeExit::~OnScopeExit' is not defined [-Wundefined-inline]
3 | struct OnScopeExit { ~OnScopeExit() {} }
| ^
<source>:4:5: note: used here
4 | pending;
| ^
1 warning generated.
ASM generation compiler returned: 0
<source>:3:26: warning: inline function '(anonymous class)::operator()(int)::OnScopeExit::~OnScopeExit' is not defined [-Wundefined-inline]
3 | struct OnScopeExit { ~OnScopeExit() {} }
| ^
<source>:4:5: note: used here
4 | pending;
| ^
1 warning generated.
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.1/../../../../x86_64-linux-gnu/bin/ld: /tmp/example-eeceaa.o: in function `auto f<int>::{lambda(auto:1)#1}::operator()<int>(int) const':
<source>:5:(.text._ZNK1fIiEMUlT_E_clIiEEDaS1_[_ZNK1fIiEMUlT_E_clIiEEDaS1_]+0x14): undefined reference to `f<int>::{lambda(auto:1)#1}::operator()<int>(int) const::OnScopeExit::~OnScopeExit()'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)Metadata
Metadata
Assignees
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.constexprAnything related to constant evaluationAnything related to constant evaluationlambdaC++11 lambda expressionsC++11 lambda expressions