bug#81312: CC Mode 5.35.2 (C++//l); Identation broken in line following C++ brace-enclosed init

Arsen Arsenović <[email protected]> Sat, 27 Jun 2026 23:41:25 +0200
Newsgroups gmane.emacs.cc-mode.general
Organization BayLibre
Message-ID <[email protected]>
--===============0151333882501094762==
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Alan Mackenzie <[email protected]> writes:

> Hello, Arsen.
>
> Thanks for the bug report.
>
> On Fri, Jun 26, 2026 at 16:02:53 +0200, Arsen Arsenovi=C4=87 wrote:
>> Package: cc-mode
>
>> Hi!
>
>> The following testcase:
>
>>   if (cp_type_quals (a) !=3D qualifier_set {}
>>           || cp_type_quals (b) !=3D qualifier_set {})
>>     return false;
>
>> ... fails to reindent, messaging "End of buffer" after hitting TAB on
>> the || line.  This seems to be caused by the {} at the end of the first
>> line, as removing it (or wrapping the inequality in parenthesis) fixes
>> the issue.
>
>> Apologies for not having debugged this yet - I am in a bit of a rush to
>> get an RFC patch out today.
>
> No worries, debugging this stuff is _my_ job.  :-)
>
> The bug was caused by a very old coding bug (possibly 30 years old),
> where the code narrowed to EOL, did a forward-list (in effect) then
> tried (forward-char).  When the closing brace is at EOL, this naturally
> throws an error.  It's just that up to now, closing braces at EOL inside
> arglists were rare in the extreme.
>
>> Emacs  : GNU Emacs 32.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3=
.24.52, cairo version 1.18.4)
>>  of 2026-06-23
>> Package: CC Mode 5.35.2 (C++//l)
>> Buffer Style: GNU
>> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen=
-string-delim gen-comment-delim syntax-properties category-properties 1-bit)
>
> Would you please try the following patch in your real C++ code, and
> report back to me whether or not it has actually fixed the bug.

That was the real code ;)

It seems to work, I didn't find any more counter-examples.  Thank you!

Have a lovely evening.
=2D-=20
Arsen Arsenovi=C4=87

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEKBAEWCgCyFiEE/uKz0RP8AKMWLWBhUsKUMB6ixJMFAmpAQ4UbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGRUUyQjNEMTEzRkMwMEEzMTYyRDYw
NjE1MkMyOTQzMDFFQTJDNDkzGBxhYXJzZW5vdmljQGJheWxpYnJlLmNvbQAKCRBS
wpQwHqLEkwodAP9mGbrS6SRvXZl9nnNhGsXPz/sXlMJuEIk2vqRDSz/CSAD/XF5t
k33JKr6Ja2+MXKmlJeRNltWf4tb/F7Af96WYWg4=
=nCPw
-----END PGP SIGNATURE-----
--=-=-=--




--===============0151333882501094762==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============0151333882501094762==--