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 @@ -20689,7 +20689,7 @@ static void FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter(
20689
20689
if (MD->getType().isNull())
20690
20690
continue;
20691
20691
20692
- const auto *Ty = cast<FunctionProtoType>( MD->getType());
20692
+ const auto *Ty = MD->getType()->getAs<FunctionProtoType>( );
20693
20693
if (!Ty || !MD->isExplicitObjectMemberFunction() ||
20694
20694
!Ty->getParamType(0)->isDependentType())
20695
20695
continue;
Original file line number Diff line number Diff line change @@ -1467,7 +1467,7 @@ void Sema::MarkThisReferenced(CXXThisExpr *This) {
1467
1467
if (MD->getType ().isNull ())
1468
1468
return false ;
1469
1469
1470
- const auto *Ty = cast<FunctionProtoType>( MD->getType ());
1470
+ const auto *Ty = MD->getType ()-> getAs <FunctionProtoType>( );
1471
1471
return Ty && MD->isExplicitObjectMemberFunction () &&
1472
1472
Ty->getParamType (0 )->isDependentType ();
1473
1473
}
Original file line number Diff line number Diff line change @@ -308,6 +308,18 @@ void TestMutationInLambda() {
308
308
l1 ();
309
309
l2 ();
310
310
}
311
+
312
+ // Check that we don't crash if the lambda has type sugar.
313
+ const auto l15 = [=](this auto &&) [[clang::annotate_type (" foo" )]] [[clang::annotate_type (" bar" )]] {
314
+ return x;
315
+ };
316
+
317
+ const auto l16 = [=]() [[clang::annotate_type (" foo" )]] [[clang::annotate_type (" bar" )]] {
318
+ return x;
319
+ };
320
+
321
+ l15 ();
322
+ l16 ();
311
323
}
312
324
313
325
struct Over_Call_Func_Example {
Original file line number Diff line number Diff line change @@ -732,3 +732,12 @@ void GH67492() {
732
732
constexpr auto test = 42 ;
733
733
auto lambda = (test, []() noexcept (true ) {});
734
734
}
735
+
736
+ namespace GH84473_bug {
737
+ void f1 () {
738
+ int b;
739
+ (void ) [=] [[gnu::regcall]] () { // expected-warning {{an attribute specifier sequence in this position is a C++23 extension}}
740
+ (void ) b;
741
+ };
742
+ }
743
+ }
You can’t perform that action at this time.
0 commit comments