Skip to content
Open
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
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,8 @@ Crash and bug fixes
``[[assume(expr)]]`` attribute was enclosed in parentheses. (#GH151529)
- Fixed a crash when parsing ``#embed`` parameters with unmatched closing brackets. (#GH152829)
- Fixed a crash when compiling ``__real__`` or ``__imag__`` unary operator on scalar value with type promotion. (#GH160583)
- Fixed a crash when evaluating nested requirements in requires-expressions that
reference invented parameters. (#GH166325)

Improvements
^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Sema/SemaExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7923,7 +7923,9 @@ concepts::Requirement *Sema::ActOnNestedRequirement(Expr *Constraint) {
concepts::NestedRequirement *
Sema::BuildNestedRequirement(Expr *Constraint) {
ConstraintSatisfaction Satisfaction;
LocalInstantiationScope Scope(*this);
if (!Constraint->isInstantiationDependent() &&
!Constraint->isValueDependent() &&
CheckConstraintSatisfaction(nullptr, AssociatedConstraint(Constraint),
/*TemplateArgs=*/{},
Constraint->getSourceRange(), Satisfaction))
Expand Down
13 changes: 13 additions & 0 deletions clang/test/SemaCXX/requires-nested-non-constant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s

template <class C> class A {
void f() {
auto result = []() constexpr {
return requires (int x) { // expected-note {{declared here}}
requires (x > 0) && (x < 10); // expected-error {{substitution into constraint expression resulted in a non-constant expression}} \
// expected-note {{while checking the satisfaction of nested requirement requested here}} \
// expected-note {{function parameter 'x' with unknown value cannot be used in a constant expression}}
};
}();
}
};