GNU bug report logs -
#56256
Emacs 28.1 gets stuck when typing some C++ code
Previous Next
Reported by: Iru Cai <vimacs <at> disroot.org>
Date: Mon, 27 Jun 2022 12:32:02 UTC
Severity: normal
Tags: patch
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Emacs gets stuck when trying to type the '&' character at the end of the
buffer when there's the following code in C++ mode (this code is from
https://www.gingerbill.org/article/2015/08/19/defer-in-cpp/):
```
template <typename F>
struct privDefer {
F f;
privDefer(F f) : f(f) {}
~privDefer() { f(); }
};
template <typename F>
privDefer<F> defer_func(F f) {
return privDefer<F>(f);
}
#define DEFER_1(x, y) x##y
#define DEFER_2(x, y) DEFER_1(x, y)
#define DEFER_3(x) DEFER_2(x, __COUNTER__)
#define defer(code) auto DEFER_3(_defer_) = defer_func([
```
Steps to reproduce:
1. create a C++ source file with this code and open it with Emacs, if
the file doesn't have a C++ source suffix, enable c++mode
2. type the '&' symbol at the last line after "defer_func(["
3. then Emacs gets stuck
I can see this bug in Emacs 28.1 and git revision
5b1bb1af030597aab7f7895b6e3da9b430f9438a. I've also tried ``emacs -Q``
and ``emacs -Q -nw``, the bug still exists.
This bug report was last modified 3 years and 55 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.