Skip to content
Commit a1879e52 authored by Aaron Ballman's avatar Aaron Ballman
Browse files

Fix crash on invalid code involving late parsed inline methods

When parsing the following construct, we parse it as an erroneous
deduction guide declaration and correctly diagnose the issues with it.

template<class> struct B;
struct A { B() noexcept(false); };

However, we then go on to finish late parsing the declaration and this
expects that what we've parsed is a CXXMethodDecl. A
CXXDeductionGuideDecl is not a CXXMethodDecl (it's a FunctionDecl), and
so we assert on the cast.

This fixes the crash by switching from cast<> to dyn_cast<> and not
setting up a "this" scope when the declaration is not a CXXMethodDecl.

This fixes PR49735.
parent 9d5e37ed
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment