File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -478,6 +478,7 @@ Bug Fixes to C++ Support
478478- Fix a crash when attempting to deduce a deduction guide from a non deducible template template parameter. (#130604)
479479- Fix for clang incorrectly rejecting the default construction of a union with
480480 nontrivial member when another member has an initializer. (#GH81774)
481+ - Fixed a template depth issue when parsing lambdas inside a type constraint. (#GH162092)
481482- Diagnose unresolved overload sets in non-dependent compound requirements. (#GH51246) (#GH97753)
482483
483484Bug Fixes to AST Handling
Original file line number Diff line number Diff line change @@ -533,6 +533,12 @@ bool Parser::isTypeConstraintAnnotation() {
533533bool Parser::TryAnnotateTypeConstraint () {
534534 if (!getLangOpts ().CPlusPlus20 )
535535 return false ;
536+ // The type constraint may declare template parameters, notably
537+ // if it contains a generic lambda, so we need to increment
538+ // the template depth as these parameters would not be instantiated
539+ // at the current depth.
540+ TemplateParameterDepthRAII CurTemplateDepthTracker (TemplateParameterDepth);
541+ ++CurTemplateDepthTracker;
536542 CXXScopeSpec SS;
537543 bool WasScopeAnnotation = Tok.is (tok::annot_cxxscope);
538544 if (ParseOptionalCXXScopeSpecifier (SS, /* ObjectType=*/ nullptr ,
Original file line number Diff line number Diff line change @@ -1514,6 +1514,31 @@ static_assert( requires {{ &f } -> C;} ); // expected-error {{reference to overl
15141514
15151515}
15161516
1517+ namespace GH162092 {
1518+
1519+ template <typename T>
1520+ struct vector ;
1521+
1522+ template <typename T, typename U>
1523+ concept C = __is_same_as(T, U);
1524+
1525+ template <class T , auto Cpt>
1526+ concept generic_range_value = requires {
1527+ Cpt.template operator ()<int >();
1528+ };
1529+
1530+
1531+ template <generic_range_value<[]<
1532+ C<int >
1533+ >() {}> T>
1534+ void x () {}
1535+
1536+ void foo () {
1537+ x<vector<int >>();
1538+ }
1539+
1540+ }
1541+
15171542namespace GH162770 {
15181543 enum e {};
15191544 template <e> struct s {};
You can’t perform that action at this time.
0 commit comments