* bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation
@ 2012-04-11 12:45 Moritz Bunkus
2016-08-14 21:18 ` Alex
0 siblings, 1 reply; 2+ messages in thread
From: Moritz Bunkus @ 2012-04-11 12:45 UTC (permalink / raw)
To: 11223
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
--
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation
2012-04-11 12:45 bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation Moritz Bunkus
@ 2016-08-14 21:18 ` Alex
0 siblings, 0 replies; 2+ messages in thread
From: Alex @ 2016-08-14 21:18 UTC (permalink / raw)
To: Moritz Bunkus; +Cc: 11223
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-14 21:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-11 12:45 bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation Moritz Bunkus
2016-08-14 21:18 ` Alex
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.