File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -8709,9 +8709,14 @@ ExplicitSafety ClangTypeExplicitSafety::evaluate(
87098709 if (auto recordDecl = clangType->getAsTagDecl ()) {
87108710 // If we reached this point the types is not imported as a shared reference,
87118711 // so we don't need to check the bases whether they are shared references.
8712- return evaluateOrDefault (evaluator,
8713- ClangDeclExplicitSafety ({recordDecl, false }),
8714- ExplicitSafety::Unspecified);
8712+ auto req = ClangDeclExplicitSafety ({recordDecl, false });
8713+ if (evaluator.hasActiveRequest (req))
8714+ // Cycles are allowed in templates, e.g.:
8715+ // template <typename> class Foo { ... }; // throws away template arg
8716+ // template <typename T> class Bar : Foo<Bar<T>> { ... };
8717+ // We need to avoid them here.
8718+ return ExplicitSafety::Unspecified;
8719+ return evaluateOrDefault (evaluator, req, ExplicitSafety::Unspecified);
87158720 }
87168721
87178722 // Everything else is safe.
You can’t perform that action at this time.
0 commit comments