Segfault when parsing an empty extern "C" {} block (#110)
extern declaration blocks can be empty: https://en.cppreference.com/w/cpp/language/language_linkage
This commit is contained in:
parent
9ab6ef877a
commit
36b64d29b9
2 changed files with 10 additions and 2 deletions
|
|
@ -15,7 +15,11 @@ cpp_entity_kind cpp_language_linkage::kind() noexcept
|
|||
|
||||
bool cpp_language_linkage::is_block() const noexcept
|
||||
{
|
||||
DEBUG_ASSERT(begin() != end(), detail::assert_handler{}, "empty container");
|
||||
if (begin() == end())
|
||||
{
|
||||
// An empty container must be a "block" of the form: extern "C" {}
|
||||
return true;
|
||||
}
|
||||
return std::next(begin()) != end(); // more than one entity, so block
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue