bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Mon, 22 Aug 2016 11:08:02 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]