Skip to content

"Function already has body?" assert on explicitly defaulted non-trivial dllexport ctor during explicit template instantiation #42202

@zmodem

Description

@zmodem
Bugzilla Link 42857
Resolution FIXED
Resolved on Aug 05, 2019 00:32
Version trunk
OS Linux
Blocks #41819
CC @zygoloid

Extended Description

struct Bar { Bar(); };
template struct Foo { __declspec(dllexport) Foo() = default; Bar b; };
template class Foo;

$ clang -c -target i686-pc-win32 /tmp/b.cc
clang-9: /work/llvm.monorepo/clang/lib/CodeGen/CodeGenFunction.cpp:662: void clang::CodeGen::CodeGenFunction::StartFunction(clang::GlobalDecl, clang::QualType, llvm::Function*, const clang::CodeGen::CGFunctionInfo&, const clang::CodeGen::FunctionArgList&, clang::SourceLocation, clang::SourceLocation): Assertion `CurFn->isDeclaration() && "Function already has body?"' failed.

Reported by Alexandre here: https://reviews.llvm.org/D65511#1608860

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillaclang:codegenIR generation bugs: mangling, exceptions, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions