Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions clang/lib/Sema/SemaConcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,11 +2408,16 @@ const NormalizedConstraint *Sema::getNormalizedAssociatedConstraints(
if (CacheEntry == NormalizationCache.end()) {
auto *Normalized = NormalizedConstraint::fromAssociatedConstraints(
*this, ND, AssociatedConstraints);
if (!Normalized) {
NormalizationCache.try_emplace(ConstrainedDeclOrNestedReq, nullptr);
return nullptr;
}
// substitute() can invalidate iterators of NormalizationCache.
bool Failed = SubstituteParameterMappings(*this).substitute(*Normalized);
CacheEntry =
NormalizationCache.try_emplace(ConstrainedDeclOrNestedReq, Normalized)
.first;
if (!Normalized ||
SubstituteParameterMappings(*this).substitute(*Normalized))
if (Failed)
return nullptr;
}
return CacheEntry->second;
Expand Down
26 changes: 26 additions & 0 deletions clang/test/SemaTemplate/concepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1632,3 +1632,29 @@ void fn3() {
}

}

namespace GH165238 {

namespace std {
template <typename, typename _Tp>
concept output_iterator = requires(_Tp __t) { __t; };
template <typename _Out> struct basic_format_context {
static_assert(output_iterator<_Out, int>);
using char_type = _Out;
};
template <typename> class basic_format_parse_context;
template <typename, typename _Context, typename _Formatter,
typename = basic_format_parse_context<typename _Context::char_type>>
concept __parsable_with = requires(_Formatter __f) { __f; };
template <typename _Tp, typename _CharT,
typename _Context = basic_format_context<_CharT>>
concept __formattable_impl = __parsable_with<_Tp, _Context, _Context>;
template <typename _Tp, typename _CharT>
concept formattable = __formattable_impl<_Tp, _CharT>;
} // namespace std
struct {
void operator()(std::formattable<char> auto);
} call;
void foo() { call(""); }

}
Loading