Skip to content

Commit d2b4249

Browse files
zyn0217nikic
authored andcommitted
release/19.x: [Clang] Consider outer instantiation scopes for constraint normalization
Backport 227afac
1 parent 70ce8d3 commit d2b4249

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

clang/lib/Sema/SemaConcept.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
967967
// parameters that the surrounding function hasn't been instantiated yet. Note
968968
// this may happen while we're comparing two templates' constraint
969969
// equivalence.
970-
LocalInstantiationScope ScopeForParameters(S);
970+
LocalInstantiationScope ScopeForParameters(S, /*CombineWithOuterScope=*/true);
971971
if (auto *FD = DeclInfo.getDecl()->getAsFunction())
972972
for (auto *PVD : FD->parameters()) {
973973
if (!PVD->isParameterPack()) {

clang/test/SemaTemplate/concepts-out-of-line-def.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,3 +622,19 @@ void A<T>::method(Ts&... ts)
622622
} {}
623623

624624
}
625+
626+
namespace GH114685 {
627+
628+
template <typename T> struct ptr {
629+
template <typename U>
630+
friend ptr<U> make_item(auto &&args)
631+
requires(sizeof(args) > 1);
632+
};
633+
634+
template <typename U>
635+
ptr<U> make_item(auto &&args)
636+
requires(sizeof(args) > 1) {}
637+
638+
ptr<char> p;
639+
640+
} // namespace GH114685

0 commit comments

Comments
 (0)