Krystian Stasiowski b24650e814
Reapply "[Clang][Sema] Always use latest redeclaration of primary template" (#114569)
This patch reapplies #114258, fixing an infinite recursion bug in
`ASTImporter` that occurs when importing the primary template of a class
template specialization when the latest redeclaration of that template
is a friend declaration in the primary template.
2024-11-01 16:15:33 -04:00

48 lines
684 B
C++

namespace N0 {
template<typename T>
struct A {
template<typename U>
friend struct A;
};
template struct A<long>;
} // namespace N0
namespace N1 {
template<typename T>
struct A;
template<typename T>
struct A {
template<typename U>
friend struct A;
};
template struct A<long>;
} // namespace N1
namespace N2 {
template<typename T>
struct A {
template<typename U>
friend struct A;
};
template<typename T>
struct A;
template struct A<long>;
} // namespace N2
namespace N3 {
struct A {
template<typename T>
friend struct B;
};
template<typename T>
struct B { };
template struct B<long>;
} // namespace N3