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 @@ -20853,7 +20853,7 @@ static void FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter(
20853
20853
if (MD->getType().isNull())
20854
20854
continue;
20855
20855
20856
- const auto *Ty = cast<FunctionProtoType>( MD->getType());
20856
+ const auto *Ty = MD->getType()->getAs<FunctionProtoType>( );
20857
20857
if (!Ty || !MD->isExplicitObjectMemberFunction() ||
20858
20858
!Ty->getParamType(0)->isDependentType())
20859
20859
continue;
Original file line number Diff line number Diff line change @@ -1494,7 +1494,7 @@ void Sema::MarkThisReferenced(CXXThisExpr *This) {
1494
1494
if (MD->getType ().isNull ())
1495
1495
return false ;
1496
1496
1497
- const auto *Ty = cast<FunctionProtoType>( MD->getType ());
1497
+ const auto *Ty = MD->getType ()-> getAs <FunctionProtoType>( );
1498
1498
return Ty && MD->isExplicitObjectMemberFunction () &&
1499
1499
Ty->getParamType (0 )->isDependentType ();
1500
1500
}
Original file line number Diff line number Diff line change @@ -312,6 +312,18 @@ void TestMutationInLambda() {
312
312
l1 ();
313
313
l2 ();
314
314
}
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 ();
315
327
}
316
328
317
329
struct 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
762
762
763
763
}
764
764
#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