GNU bug report logs -
#11223
24.0.94; C++11 initializer lists cause wrong indentation
Previous Next
Reported by: Moritz Bunkus <moritz <at> bunkus.org>
Date: Wed, 11 Apr 2012 16:05:03 UTC
Severity: normal
Found in version 24.0.94
Fixed in version 24.5
Done: Alex <agrambot <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 11223 <at> debbugs.gnu.org (full text, mbox):
close 24.5
quit
Moritz Bunkus <moritz <at> 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.
This bug report was last modified 8 years and 345 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.