[PATCH] D98068: Remove asserts for LocalInstantiationScope

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 8 10:43:04 PST 2021


tra added a comment.

Godbolt appears to be OK with the code for both gcc and clang: https://godbolt.org/z/enec44

Debug build does assert here:

  clang++: /work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiate.cpp:3630: void clang::LocalInstantiationScope::InstantiatedLocal(const clang::Decl *, clang::Decl *): Assertion `Current->LocalDecls.find(D) == Current->LocalDecls.end() && "Instantiated local in inner and outer scopes"' failed.
  ...
   #12 0x00007f8aa3941b9f clang::LocalInstantiationScope::InstantiatedLocal(clang::Decl const*, clang::Decl*) /work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiate.cpp:3627:5
   #13 0x00007f8aa39bd090 addInstantiatedParametersToScope(clang::Sema&, clang::FunctionDecl*, clang::FunctionDecl const*, clang::LocalInstantiationScope&, clang::MultiLevelTemplateArgumentList const&) /work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4293:7
   #14 0x00007f8aa39be985 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /work/llvm/repo/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4869:9
   #15 0x00007f8aa3929378 clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool)::$_10::operator()() const /work/llvm/repo/clang/lib/Sema/SemaTemplateDeduction.cpp:5025:5
   #16 0x00007f8aa3929335 void llvm::function_ref<void ()>::callback_fn<clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool)::$_10>(long) /work/llvm/repo/llvm/include/llvm/ADT/STLExtras.h:185:5
   #17 0x00007f8aa28d9ff9 llvm::function_ref<void ()>::operator()() const /work/llvm/repo/llvm/include/llvm/ADT/STLExtras.h:209:5
   #18 0x00007f8aa28c4b0d clang::runWithSufficientStackSpace(llvm::function_ref<void ()>, llvm::function_ref<void ()>) /work/llvm/repo/clang/include/clang/Basic/Stack.h:52:3
   #19 0x00007f8aa28b1de4 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) //work/llvm/repo/clang/lib/Sema/Sema.cpp:458:1
   #20 0x00007f8aa3851a7f clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool) /work/llvm/repo/clang/lib/Sema/SemaTemplateDeduction.cpp:5028:25
   #21 0x00007f8aa2fe10a4 clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*) /llvm/repo/clang/lib/Sema/SemaExpr.cpp:291:9
   #22 0x00007f8aa35e47eb CreateFunctionRefExpr(clang::Sema&, clang::FunctionDecl*, clang::NamedDecl*, clang::Expr const*, bool, clang::SourceLocation, clang::DeclarationNameLoc const&) /work/llvm/repo/clang/lib/Sema/SemaOverload.cpp:65:28
   #23 0x00007f8aa35ecba0 clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation) /work/llvm/repo/clang/lib/Sema/SemaOverload.cpp:14630:22
   #24 0x00007f8aa2fe7574 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) /work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:6396:
  ...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98068/new/

https://reviews.llvm.org/D98068



More information about the cfe-commits mailing list