Page MenuHomePhabricator

[SemaCXX] Fix ICE for unexpanded parameter pack

Authored by modocache on Jan 3 2019, 7:31 AM.



The documentation for RecursiveASTVisitor::TraverseDecl states that the
Decl being traversed may be null. In fact, this is the case when a
CXXCatchStmt with no exception decl is traversed. Because the visitor
for diagnosing unexpanded parameter packs does not check for null, it
ends up crashing when it attempts to call the Decl::isParameterPack
method on a null Decl pointer.

Add a null check to prevent an ICE, and a test case that would crash
otherwise. Also, because the test requires C++ exceptions and C++14,
change the test parameters for the entire test file. (Alternatively, I
thought about adding a new test file, but went with this approach for my
own convenience.)

Co-authored-by: Andreas Molzer <>
Co-authored-by: Mara Bos <>

Diff Detail


Event Timeline

modocache created this revision.Jan 3 2019, 7:31 AM
rsmith accepted this revision.Jan 3 2019, 10:50 AM

Looks good, thank you!

This revision is now accepted and ready to land.Jan 3 2019, 10:50 AM
This revision was automatically updated to reflect the committed changes.

Thank you for the review!