Subject: bug#22486: CC Mode 5.33 (C++/l); Bad indentation in a hideous C++ struct

From: Michael Welsh Duggan <[email-masked]>
Date: Sun, 14 Feb 2016 15:41:29 -0500

Alan Mackenzie <[email-masked]> writes:

> Hello, Michael.
>
> On Fri, Feb 05, 2016 at 02:01:52PM -0500, Michael Welsh Duggan wrote:
>> Alan Mackenzie <[email-masked]> 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
([email-masked])