Fix GH57943: Friend constraint checker didn't handle null decls.

Apparently TransformDecl in TreeTransform can be called with a nullptr
for a Decl, so my casts were illegal.  The fix here is to add an early
exit to my TransformDecl.
This commit is contained in:
Erich Keane 2022-09-23 12:17:12 -07:00
parent ddfa0f62d8
commit 0d18815baf
2 changed files with 9 additions and 0 deletions

View File

@ -1716,6 +1716,8 @@ public:
}
Decl *TransformDecl(SourceLocation Loc, Decl *D) {
if (!D)
return D;
// FIXME : This is possibly an incomplete list, but it is unclear what other
// Decl kinds could be used to refer to the template parameters. This is a
// best guess so far based on examples currently available, but the

View File

@ -0,0 +1,7 @@
// RUN: %clang_cc1 -std=c++20 -verify %s
// expected-no-diagnostics
struct s {
template<typename T>
requires requires(T x) { x.g(); }
friend void f(T);
};