[llvm-bugs] [Bug 27229] New: Assertion failure when recovering from unknown identifier.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 5 14:36:30 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27229

            Bug ID: 27229
           Summary: Assertion failure when recovering from unknown
                    identifier.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: crash-on-invalid
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ cat test.cc
class Runner {
  void Run();
};

template <typename, typename>
class Two {};
template <typename>
class One {};
class Zero {};

namespace {

void Stop(const Two<int, One<Unknown>>&) {}
}

const int kTwenty = 20;

void Runner::Run() {
  switch (0)
  case 0:
  Zero zero;
}
$ clang -std=c++11 test.cc
test.cc:13:30: error: use of undeclared identifier 'Unknown'
void Stop(const Two<int, One<Unknown>>&) {}
                             ^
test.cc:14:1: error: expected a type
}
^
test.cc:16:23: error: expected ')'
const int kTwenty = 20;
                      ^
test.cc:13:10: note: to match this '('
void Stop(const Two<int, One<Unknown>>&) {}
         ^
test.cc:18:14: error: cannot define or redeclare 'Run' here because namespace
''
      does not enclose namespace 'Runner'
void Runner::Run() {
     ~~~~~~~~^
clang-3.5: ../include/llvm/ADT/SmallVector.h:164: reference
llvm::SmallVectorTemplateCommon<clang::SwitchStmt *, void>::back() [T =
clang::SwitchStmt *]: Assertion `!empty()' failed.

The identifier 'Unknown' is not defined, causing the first error.  However, the
recover from that error messes up the scope, causing the assertion failure when
processing the switch statement.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160405/e3c3d54e/attachment.html>


More information about the llvm-bugs mailing list