[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47468: 27.1; cc-mode: Got incorrect indentaton for C++ lambda functi
From: |
Lars Ingebrigtsen |
Subject: |
bug#47468: 27.1; cc-mode: Got incorrect indentaton for C++ lambda function. |
Date: |
Wed, 12 May 2021 23:57:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Jianbin Kang <kjbmail@gmail.com> writes:
> int main(int argc, char *argv[])
> {
> PP A = { "Jim" };
> PP *a = &A;
>
> print(A.name, [](const char *name) {
> printf("%s\n", name); // Syntactic ((inlambda) ...
> });
> print(a->name, [=](const char *name) {
> printf("%s\n", name); // Syntactic((arglist-cont-nonempty
> ...
> });
>
> return 0;
[...]
> If I put cursor in lambda body of first print call, and run
> 'c-show-syntactic-information',
> it shows 'Syntactic analysis: ((inlambda) (defun-block-intro 258))', which is
> correct and
> I get good indentation.
>
> But in second print call, I get 'Syntactic analysis:
> ((arglist-cont-nonempty 337 342) (statement-block-intro 337))' and the
> indentation is bad.
I can reproduce this in Emacs 28, too. Poking around a bit, it seems
like it's getting tripped up by the "a->name" bit? Changing that to
a.name (for instance) makes it recognise the second form as a lambda
function...
However, the first form is indented wrong for me in Emacs 28:
This is indented correctly in Emacs 27.1, so it seems like this has
regressed between Emacs 27.1 and Emacs 28.
I've added Alan to the CCs.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#47468: 27.1; cc-mode: Got incorrect indentaton for C++ lambda function.,
Lars Ingebrigtsen <=