[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24195: 25.0.95; Wrong indentation after a 'less < than' comparison (
From: |
Alan Mackenzie |
Subject: |
bug#24195: 25.0.95; Wrong indentation after a 'less < than' comparison (c++-mode) |
Date: |
Thu, 11 Aug 2016 12:14:21 +0000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Hello, Arash.
On Wed, Aug 10, 2016 at 02:08:52PM +0430, Arash wrote:
> $ emacs -Q test.cc
> bool test()
> {
> return \
> a() <= b() &&
> c() >= d() &&
> e() == f() &&
> g() != h() &&
> i() > j() &&
> k() < l() &&
^
> m() == n() // !!!
> ;
> }
Yes. In the line "k() < l() &&", the "<" is being recognised as a
template opener.
The syntax of C++ is ambiguous, and it is difficult for anything which
isn't a compiler reliably to distinguish between "less than" and "open
template" in circumstances like that. It was easier for earlier
versions of C++, where the "&&" operator wasn't valid inside a template.
I'm not sure I can do very much to help, here. Even waiting on the
closing ">" before recognising a template wouldn't help much, because
you're just as likely to have the line with "<" before the line with
">".
There are crude workarounds, like writing "!(k() >= l()), but that's
horrible.
So, sorry and all that, I don't think I can do anything to fix this.
--
Alan Mackenzie (Nuremberg, Germany).