[LLVMbugs] [Bug 7947] New: crash in DiagnoseEmptyLookup

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 19 21:38:58 PDT 2010


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

           Summary: crash in DiagnoseEmptyLookup
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


This small testcase crashes:

  template <typename> struct A {
    static void Work();
  };

  template <typename T> struct B : public A<T> {
    template <typename T2> B(T2 x) { Work(x); }
  };

  void Test() { B<int> b(0); }

GCC accepts it of course. Here's the stacktrace:

$ clang -cc1 -x c++ 005.c
005.c:6:36: error: use of undeclared identifier 'Work'
  template <typename T2> B(T2 x) { Work(x); }
                                   ^
                                   this->
005.c:9:22: note: in instantiation of function template specialization
'B<int>::B<int>' requested here
void Test() { B<int> b(0); }
                     ^
0  clang           0x00000000020fd5e0
1  clang           0x00000000020fd4a4
2  libpthread.so.0 0x00007f15fc2df8f0
3  clang           0x0000000000eded42 clang::Decl::getKind() const + 12
4  clang           0x0000000000f3da65 clang::CXXMethodDecl::classof(clang::Decl
const*) + 24
5  clang           0x000000000103da13 llvm::isa_impl<clang::CXXMethodDecl,
clang::FunctionDecl>::doit(clang::FunctionDecl const&) + 24

6  clang           0x000000000103d062 llvm::isa_impl_wrap<clang::CXXMethodDecl,
clang::FunctionDecl const, clang::FunctionDecl const>::doit(clang::FunctionDecl
const&) + 24
7  clang           0x000000000103ba3e bool
llvm::isa_impl_cl<clang::FunctionDecl>::isa<clang::CXXMethodDecl>(clang::FunctionDecl
const&) + 24
8  clang           0x000000000118ae9b bool
llvm::isa_impl_cl<clang::FunctionDecl*>::isa<clang::CXXMethodDecl>(clang::FunctionDecl*)
+ 24
9  clang           0x000000000118a6ba bool llvm::isa<clang::CXXMethodDecl,
clang::FunctionDecl*>(clang::FunctionDecl* const&) + 27
10 clang           0x0000000001189fa4 llvm::cast_retty<clang::CXXMethodDecl,
clang::FunctionDecl*>::ret_type llvm::cast<clang::CXXMethodDecl,
clang::FunctionDecl*>(clang::FunctionDecl* const&) + 24
11 clang           0x000000000122636f
clang::Sema::DiagnoseEmptyLookup(clang::Scope*, clang::CXXScopeSpec&,
clang::LookupResult&, clang::Sema::CorrectTypoContext) + 679
12 clang           0x00000000012b8734
13 clang           0x00000000012b8b89
clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*,
clang::UnresolvedLookupExpr*, clang::SourceLocation, clang::Expr**, unsigned
int, clang::SourceLocation*, clang::SourceLocation) + 613
14 clang           0x0000000001232623 clang::Sema::ActOnCallExpr(clang::Scope*,
clang::ASTOwningPtr<&(clang::ActionBase::DeleteExpr(void*))>,
clang::SourceLocation,
clang::ASTMultiPtr<&(clang::ActionBase::DeleteExpr(void*))>,
clang::SourceLocation*, clang::SourceLocation) + 2347
15 clang           0x000000000131f83e
16 clang           0x000000000131ba31
17 clang           0x0000000001318089
18 clang           0x000000000131d9b9
19 clang           0x000000000131d4a6
20 clang           0x00000000013324c0
21 clang           0x000000000132492c
22 clang           0x000000000131d0f4
23 clang           0x000000000131b2bd clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 125
24 clang           0x000000000133f777
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 1341
25 clang           0x0000000001341469
clang::Sema::PerformPendingImplicitInstantiations(bool) + 371
26 clang           0x0000000001176340 clang::Sema::ActOnEndOfTranslationUnit()
+ 62
27 clang           0x00000000015d111b
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<1>&) + 97

28 clang           0x0000000001173a67 clang::ParseAST(clang::Sema&, bool) + 331
29 clang           0x0000000000ec84c8 clang::ASTFrontendAction::ExecuteAction()
+ 264
30 clang           0x0000000000ec8112 clang::FrontendAction::Execute() + 320
31 clang           0x0000000000eaee86
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 752
32 clang           0x0000000000ec6e14
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 856
33 clang           0x0000000000ea0a4f cc1_main(char const**, char const**, char
const*, void*) + 942
34 clang           0x0000000000ea95e2 main + 499
35 libc.so.6       0x00007f15fb5b9c4d __libc_start_main + 253
36 clang           0x0000000000ea0119
Stack dump:
0.      Program arguments:
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang -cc1 -x c++ 005.c 
1.      <eof> parser at end of file
2.      005.c:6:26: instantiating function definition 'B<int>::B'
Segmentation fault

-- 
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