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(
20704
20704
if (MD->getType().isNull())
20705
20705
continue;
20706
20706
20707
- const auto *Ty = cast<FunctionProtoType>( MD->getType());
20707
+ const auto *Ty = MD->getType()->getAs<FunctionProtoType>( );
20708
20708
if (!Ty || !MD->isExplicitObjectMemberFunction() ||
20709
20709
!Ty->getParamType(0)->isDependentType())
20710
20710
continue;
Original file line number Diff line number Diff line change @@ -1488,7 +1488,7 @@ void Sema::MarkThisReferenced(CXXThisExpr *This) {
1488
1488
if (MD->getType().isNull())
1489
1489
return false;
1490
1490
1491
- const auto *Ty = cast<FunctionProtoType>( MD->getType());
1491
+ const auto *Ty = MD->getType()->getAs<FunctionProtoType>( );
1492
1492
return Ty && MD->isExplicitObjectMemberFunction() &&
1493
1493
Ty->getParamType(0)->isDependentType();
1494
1494
}
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