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: Moritz Bunkus
Subject: bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation
Date: Wed, 11 Apr 2012 14:45:51 +0200

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





reply via email to

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