all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Arash <pbqbqp@gmail.com>
Cc: 24195@debbugs.gnu.org
Subject: bug#24195: 25.0.95; Wrong indentation after a 'less < than' comparison (c++-mode)
Date: Thu, 11 Aug 2016 12:14:21 +0000	[thread overview]
Message-ID: <20160811121421.GA3753@acm.fritz.box> (raw)
In-Reply-To: <86a8glhsk3.fsf@gmail.com>

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).





  parent reply	other threads:[~2016-08-11 12:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10  9:38 bug#24195: 25.0.95; Wrong indentation after a 'less < than' comparison (c++-mode) Arash
2016-08-10 22:07 ` Robert Cochran
2016-08-11 12:14 ` Alan Mackenzie [this message]
2016-08-12 15:26   ` Noam Postavsky
2016-08-12 16:56     ` Andreas Schwab
2016-08-18 12:11       ` npostavs
2016-08-22 11:08         ` Alan Mackenzie
2016-08-25  1:24           ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160811121421.GA3753@acm.fritz.box \
    --to=acm@muc.de \
    --cc=24195@debbugs.gnu.org \
    --cc=pbqbqp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.