GNU bug report logs - #22486
CC Mode 5.33 (C++/l); Bad indentation in a hideous C++ struct

Previous Next

Package: cc-mode;

Reported by: Michael Welsh Duggan <mwd <at> md5i.com>

Date: Thu, 28 Jan 2016 20:38:01 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Welsh Duggan <mwd <at> md5i.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 22486 <at> debbugs.gnu.org, Michael Welsh Duggan <mwd <at> cert.org>
Subject: bug#22486: CC Mode 5.33 (C++/l); Bad indentation in a hideous C++ struct
Date: Sun, 14 Feb 2016 15:41:29 -0500
Alan Mackenzie <acm <at> muc.de> writes:

> Hello, Michael.
>
> On Fri, Feb 05, 2016 at 02:01:52PM -0500, Michael Welsh Duggan wrote:
>> Alan Mackenzie <acm <at> muc.de> writes:
>
>> > On Thu, Jan 28, 2016 at 03:37:07PM -0500, Michael Welsh Duggan wrote:
>> >> In the following C++ snippet:
>
>> >> template <typename Arg, typename... Args>
>> >> struct ArgListMatcher<Arg, Args...> :
>> >>     ArgListMatcher<MakeIndices<CountRef<Arg>::value>,
>> >>                    MakeIndices<sizeof...(Args) - CountRef<Arg>::value, CountRef<Arg>::value>,
>> >>                        Arg, Args...>    <============================
>> >> {
>> >>   using Parent = ArgListMatcher<
>> >>     MakeIndices<CountRef<Arg>::value>,
>> >>     MakeIndices<sizeof...(Args) + 1 - CountRef<Arg>::value,
>> >>                 CountRef<Arg>::value>, Arg, Args...>;
>> >>   using Parent::ArgListMatcher;
>> >> };
>
>> >> Starting with "template" as the first line, the lines' contexts are
>> >> listed as:
>
>> >> syntax: ((topmost-intro 1)), indent: 0
>> >> syntax: ((topmost-intro-cont 1)), indent: 0
>> >> syntax: ((inher-intro 1)), indent: 4
>> >> syntax: ((template-args-cont 1 99)), indent: 19
>> >> syntax: ((member-init-intro 154)), indent: 23  <=====================
>> >> syntax: ((defun-open 1)), indent: 0
>
>> >> All of these seem reasonable save for member-init-intro, which I
>> >> expected to be template-args-cont.
>
> Please see the patch below.  Basically, I've had to slacken the criteria
> for detecting template delimiters, so the danger of mistaking a
> less-than followed by a greater-than for a template are higher than they
> were.  Come to think of it, the danger probably isn't that high anyway.
>
> Would you please do the usual with the patch and let me know how well
> the problem is solved in real code.  Thanks!

Seems to work for me.  Thanks!  (Have fun with the more recent bug I
sent you, #22644.  I verified that it still bugs with this patch.)

-- 
Michael Welsh Duggan
(md5i <at> md5i.com)




This bug report was last modified 9 years and 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.