all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#47468: 27.1; cc-mode: Got incorrect indentaton for C++ lambda function.
@ 2021-03-29 12:47 Jianbin Kang
  2021-05-12 21:57 ` Lars Ingebrigtsen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jianbin Kang @ 2021-03-29 12:47 UTC (permalink / raw)
  To: 47468

[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]

The c++ file to reproduce it:
```c++
#include <stdio.h>
#include <functional>

struct PP {
    const char *        name;
};

static void print(const char *name, std::function<void(const char *)> f)
{
    f(name);
}

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.

My emacs version is 27.1. I can reproduce the problem in both Linux and
Windows with 'emacs -Q'.

[-- Attachment #2: Type: text/html, Size: 1320 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-15 19:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-29 12:47 bug#47468: 27.1; cc-mode: Got incorrect indentaton for C++ lambda function Jianbin Kang
2021-05-12 21:57 ` Lars Ingebrigtsen
2021-05-15 14:57 ` Alan Mackenzie
2021-08-15 19:51   ` Alan Mackenzie
2021-05-19 20:49 ` Vladimir Lichevsky

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.