LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 8505 - compiler crash with forward declarations and templates
Summary: compiler crash with forward declarations and templates
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-29 09:27 PDT by Steffen Kieß
Modified: 2010-11-03 22:19 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Kieß 2010-10-29 09:27:34 PDT
The following code will crash clang trunk (r117648):

template <int i> class A {
  class B* g;
};
class B {
  void f () {}
};
template class A<0>;


Output:
clang: /home/steffen/prog/llvm/tools/clang/lib/Sema/../../include/clang/AST/DependentDiagnostic.h:178: clang::DeclContext::ddiag_iterator clang::DeclContext::ddiag_begin() const: Assertion `isDependentContext() && "cannot iterate dependent diagnostics of non-dependent context"' failed.

Adding "class B;" at the start of the source file will fix the problem.
Comment 1 Ted Kremenek 2010-10-29 14:32:27 PDT
also cloned to <rdar://problem/8611125>
Comment 2 Argyrios Kyrtzidis 2010-11-03 22:19:51 PDT
Fixed at r118235.