bug#72695: CC Mode 5.35.2 (C++//l); c++-mode misindents 'if constexpr' inside lambdas

Arsen Arsenović via CC-Mode-help <[email protected]> Fri, 27 Sep 2024 23:54:57 +0200
Newsgroups gmane.emacs.cc-mode.general
Message-ID <[email protected]>
--===============8008770930112051104==
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"

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

Hi Alan,

Alan Mackenzie <[email protected]> writes:

> I've now committed a slightly different patch, after noticing and fixing
> another bug.
>
> The bug was that in code like
>
> 1 template <typename T>
> 2 requires requires (T x)
> 3 { x + x; }
> 4 T add(T a, T b)
> 5 {
> 6    return a + b;
> 7 }
>
> , L4, a topmost-intro-cont used to be anchored on the previous
> topmost-intro-cont line, L2, whereas it should be anchored on the
> topmost-intro, L1.
>
> I've now corrected this.

Ah!  Good catch.

> I didn't send you yet another patch with request for testing, because
> I've done that rather a lot of late, and I'm confident about the patch.
>
> I haven't yet closed the bug, just in case you wanted to do some final,
> final testing on the committed version.  Please let me know what you feel
> about that, so that I can finally close this bug.

I'm not sure this is a bug but it is something I noticed by accident:

      (std::visit
       ([] <typename T>
       	(const T& data)
	{
        }));

... the { is not an inline-open, but an arglist-cont-nonempty (though,
to be clear, the body is indented okay; I've elided it from the example
above for that reason).

Same goes for the (const T& data), which doesn't get indented the same
as a 'standalone' lambda, but it does indent the same as one saved into
a variable:

  []
    ()
  {
  };
  auto x =3D
    []
    ()
    {
    };
  auto x =3D
    ([]
     ()
    {
    });

I do not know whether this is correct.

But thank you again for working on this!

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

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

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

iOYEARYKAI4WIQT+4rPRE/wAoxYtYGFSwpQwHqLEkwUCZvcpsV8UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0RkVF
MkIzRDExM0ZDMDBBMzE2MkQ2MDYxNTJDMjk0MzAxRUEyQzQ5MxAcYXJzZW5AYWFy
c2VuLm1lAAoJEFLClDAeosSTLAgA/iCwh+CocQvsJSYetGpQWVpIXEBkVc4JuMSZ
iIRH5hGAAQDgEqRC+TusGmQZT3u7sX65sds9+ta6rN5RcQquGqvcCw==
=2T3W
-----END PGP SIGNATURE-----
--=-=-=--




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


--===============8008770930112051104==--