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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation


From: Alex
Subject: bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation
Date: Sun, 14 Aug 2016 15:18:12 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

close 24.5
quit

Moritz Bunkus <moritz@bunkus.org> writes:

> C++11 introduces the use of { } as object initializer lists instead of
> the usual ( ). Using them often causes Emacs & cc-mode to use very
> strange indentation. One example is below.
>
> Tested both with c-version 5.32.2 and 5.33.
>
> How to reproduce:
>
> Save the text between the ===== lines into a file, e.g. "test.cc". Start
> Emacs with or without -Q on the file. Select the whole buffer, run
> `indent-region`.
>
> ============================================================
> class Foo: public QThingy {
> protected:
>   SomeObject thingy;
>   std::string whatever;
> public:
>   Foo()
>     : thingy{ utilityFunction(42, QList<int>{} << 42 << 54) }
>                                                   , whatever{"broken"}
>   {
>   }
> };
>
> class Foo: public QThingy {
> protected:
>   SomeObject thingy;
>   std::string whatever;
> public:
>   Foo()
>     : thingy( utilityFunction(42, QList<int> << 42 << 54) )
>     , whatever( "working" )
>   {
>   }
> };
> ============================================================
>
> In GNU Emacs 24.0.94.1 (x86_64-pc-linux-gnu, GTK+ Version 3.2.0)
>  of 2012-03-19 on rhenium, modified by Debian

Both the top and bottom classes appear to indent correctly in Emacs 24.5.





reply via email to

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