[LLVMbugs] [Bug 10883] New: Crash stemming from typo correction when compiling template subclass

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 7 12:34:33 PDT 2011


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

           Summary: Crash stemming from typo correction when compiling
                    template subclass
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rikka at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following code causes clang to crash due to a NULL Decl pointer:

template <typename T>
class Base {
 public:
  typedef long Container;
};

template <typename T>
class Derived : public Base<T> {
 public:
  using Base<T>::Container;

  void foo(const Container& current);
};


The crash is at SemaDecl.cpp:310

309   NamedDecl *Result = Corrected.getCorrectionDecl();
310   if ((isa<TypeDecl>(Result) || isa<ObjCInterfaceDecl>(Result)) &&
311   !Result->isInvalidDecl()) {

(gdb) p Result
$1 = (clang::NamedDecl *) 0x0

Simply put, this is a situation where Sema::CorrectTypo returns a non-keyword
correction without an associated NamedDecl.

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