[LLVMbugs] [Bug 13660] New: SemaLookup.cpp:1365 assertion `isa<TagDecl>(D) && "Non-function must be a tag decl"` failed on templated class-member operator delete

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 22 04:15:13 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13660

             Bug #: 13660
           Summary: SemaLookup.cpp:1365 assertion `isa<TagDecl>(D) &&
                    "Non-function must be a tag decl"` failed on templated
                    class-member operator delete
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ingmar.sittl at elektrobit.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


llvm/tools/clang/lib/Sema/SemaLookup.cpp:1366: bool
HasOnlyStaticMembers(InputIterator, InputIterator) [with InputIterator =
clang::NamedDecl**]: Assertion `isa<TagDecl>(D) && "Non-function must be a tag
decl"' failed

  clang     0x09d77aa8
1  clang     0x09d77fd4
2            0xffffe400  + 0
3  libc.so.6 0xb750c8c5 gsignal + 69
4  libc.so.6 0xb750e1d5 abort + 373
5  libc.so.6 0xb75053e4
6  libc.so.6 0xb7505497
7  clang     0x0891bba9
8  clang     0x08922256
9  clang     0x088ce639
clang::Sema::FindDeallocationFunction(clang::SourceLocation,
clang::CXXRecordDecl*, clang::DeclarationName, clang::FunctionDecl*&, bool) +
297
10 clang     0x08812b76 clang::Sema::CheckDestructor(clang::CXXDestructorDecl*)
+ 198
11 clang     0x0883b46f
clang::Sema::DefineImplicitDestructor(clang::SourceLocation,
clang::CXXDestructorDecl*) + 351
12 clang     0x0888c9a6
clang::Sema::MarkFunctionReferenced(clang::SourceLocation,
clang::FunctionDecl*) + 1398
13 clang     0x0882181a
clang::Sema::MarkVirtualMembersReferenced(clang::SourceLocation,
clang::CXXRecordDecl const*) + 298
14 clang     0x0883a811 clang::Sema::DefineUsedVTables() + 369
15 clang     0x0874531a clang::Sema::ActOnEndOfTranslationUnit() + 426
16 clang     0x086b0529
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 393
17 clang     0x086a6fb6 clang::ParseAST(clang::Sema&, bool, bool) + 550
18 clang     0x083c9cef clang::ASTFrontendAction::ExecuteAction() + 111
19 clang     0x0852b15b clang::CodeGenAction::ExecuteAction() + 43
20 clang     0x083ca630 clang::FrontendAction::Execute() + 176
21 clang     0x083aab48
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 312
22 clang     0x083902cd
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1197
23 clang     0x08387694 cc1_main(char const**, char const**, char const*,
void*) + 948
24 clang     0x083705c6 main + 758
25 libc.so.6 0xb74f8003 __libc_start_main + 243
26 clang     0x08384fbd


when I remove the assertion and instead set AllMethodsAreStatic to false, I see
that the following declaration leads to problems:

template<typename T>
void operator delete(void* p, Allocator<T> &allocator)
{
  allocator.free(p);
}


the error with the removed assert is as follows

error: non-static member 'operator delete' found in multiple base-class
subobjects of type 'A':
     class PVT -> PS <PV> -> class I -> I<P> -> class A
     class PVT -> I <class PVT, struct tag> -> class A
A.h:
note: member found by ambiguous name lookup
     void operator delete(void* p, Allocator<T> &allocator)
          ^
PVT.h
note: implicit default destructor for 'PVT' first required here
     PVT( N const& name
     ^
1 error generated


the assert still happens even after changing the signature of the templated
operator delete operator to 

template<typename T>
static void operator delete(void* p, Allocator<T> &allocator)

so it looks like the isa<CXXMethodDecl>(D) that happens before the assert does
not check that this templated method declaration is a valid method declaration

I'm currently trying to produce a reduced test-case as the code that leads to
this assert is quite complex while most of it is probably irrelevant to the
problem at hand

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list