unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: npostavs@users.sourceforge.net
Cc: Arash <pbqbqp@gmail.com>, Andreas Schwab <schwab@linux-m68k.org>,
	24195@debbugs.gnu.org
Subject: bug#24195: 25.0.95; Wrong indentation after a 'less < than' comparison (c++-mode)
Date: Mon, 22 Aug 2016 11:08:02 +0000	[thread overview]
Message-ID: <20160822110802.GB2571@acm.fritz.box> (raw)
In-Reply-To: <87inuyuvip.fsf@users.sourceforge.net>

Hello, Noam.

On Thu, Aug 18, 2016 at 08:11:26AM -0400, npostavs@users.sourceforge.net wrote:
> Andreas Schwab <schwab@linux-m68k.org> writes:

> > On Aug 12 2016, Noam Postavsky <npostavs@users.sourceforge.net> wrote:

> >> On Thu, Aug 11, 2016 at 8:14 AM, Alan Mackenzie <acm@muc.de> wrote:
> >>> Yes.  In the line "k() < l() &&", the "<" is being recognised as a
> >>> template opener.

> >> Is it possible to say that "<" can't be a template opener when it
> >> comes after a close paren? (I can't think of a case in C++ where that
> >> would fail, though I'm not 100% certain there isn't one)

> > operator()<foo>

> So could we say "<" can't be a template opener when it comes after a
> close paren except for the close paren of "operator()"?

We could, but I can't see it helping very much (though it might help a
little bit).

There are probably quite a lot of special cases like that where it is
possible to say for sure that the "<" does/doesn't introduce a template
construct.  But that will leave a lot of ambiguous cases.  The more we
try to analyse these, the closer we get to building a compiler inside CC
Mode.  For example, the example given might have been "k < l() && ....",
leaving no syntactic clues about the templateicity of "<".

Analysing the C++ syntax to determine these determinable cases would be
a lot of work, and it would be a lot of work to implement it, too.

The C++ standards people haven't thought it worthwhile to preserve
unambigious syntax in their language, so there is no way CC Mode can get
it right every time.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2016-08-22 11:08 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20160822110802.GB2571@acm.fritz.box \
    --to=acm@muc.de \
    --cc=24195@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    --cc=pbqbqp@gmail.com \
    --cc=schwab@linux-m68k.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).