File tree Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -20704,7 +20704,7 @@ static void FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter(
2070420704 if (MD->getType().isNull())
2070520705 continue;
2070620706
20707- const auto *Ty = cast<FunctionProtoType>( MD->getType());
20707+ const auto *Ty = MD->getType()->getAs<FunctionProtoType>( );
2070820708 if (!Ty || !MD->isExplicitObjectMemberFunction() ||
2070920709 !Ty->getParamType(0)->isDependentType())
2071020710 continue;
Original file line number Diff line number Diff line change @@ -1488,7 +1488,7 @@ void Sema::MarkThisReferenced(CXXThisExpr *This) {
14881488 if (MD->getType ().isNull ())
14891489 return false ;
14901490
1491- const auto *Ty = cast<FunctionProtoType>( MD->getType ());
1491+ const auto *Ty = MD->getType ()-> getAs <FunctionProtoType>( );
14921492 return Ty && MD->isExplicitObjectMemberFunction () &&
14931493 Ty->getParamType (0 )->isDependentType ();
14941494 }
Original file line number Diff line number Diff line change @@ -312,6 +312,18 @@ void TestMutationInLambda() {
312312 l1 ();
313313 l2 ();
314314 }
315+
316+ // Check that we don't crash if the lambda has type sugar.
317+ const auto l15 = [=](this auto &&) [[clang::annotate_type (" foo" )]] [[clang::annotate_type (" bar" )]] {
318+ return x;
319+ };
320+
321+ const auto l16 = [=]() [[clang::annotate_type (" foo" )]] [[clang::annotate_type (" bar" )]] {
322+ return x;
323+ };
324+
325+ l15 ();
326+ l16 ();
315327}
316328
317329struct Over_Call_Func_Example {
Original file line number Diff line number Diff line change @@ -762,3 +762,12 @@ template auto t::operator()<int>(int a) const; // expected-note {{in instantiati
762762
763763}
764764#endif
765+
766+ namespace GH84473_bug {
767+ void f1 () {
768+ int b;
769+ (void ) [=] [[gnu::regcall]] () { // expected-warning {{an attribute specifier sequence in this position is a C++23 extension}}
770+ (void ) b;
771+ };
772+ }
773+ }
You can’t perform that action at this time.
0 commit comments