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.
Loading
Please sign in to comment