From unknown Fri Aug 22 01:33:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation Resent-From: Moritz Bunkus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Apr 2012 16:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11223 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 11223@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13341602965529 (code B ref -1); Wed, 11 Apr 2012 16:05:03 +0000 Received: (at submit) by debbugs.gnu.org; 11 Apr 2012 16:04:56 +0000 Received: from localhost ([127.0.0.1]:52283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SI02S-0001R8-5m for submit@debbugs.gnu.org; Wed, 11 Apr 2012 12:04:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57503) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHwxQ-0001g3-Os for submit@debbugs.gnu.org; Wed, 11 Apr 2012 08:47:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SHwwG-00017l-16 for submit@debbugs.gnu.org; Wed, 11 Apr 2012 08:46:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:52080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SHwwF-00017f-Tk for submit@debbugs.gnu.org; Wed, 11 Apr 2012 08:46:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SHwwE-0008AT-6c for bug-gnu-emacs@gnu.org; Wed, 11 Apr 2012 08:46:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SHww4-00016X-Ve for bug-gnu-emacs@gnu.org; Wed, 11 Apr 2012 08:46:17 -0400 Received: from belgarath.bunkus.org ([78.46.80.115]:41042 helo=liselle.bunkus.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SHww4-00015b-PN for bug-gnu-emacs@gnu.org; Wed, 11 Apr 2012 08:46:08 -0400 Received: from tionne.local (unknown [10.55.1.10]) by liselle.bunkus.org (Postfix) with ESMTPS id BE22B1BC11FA for ; Wed, 11 Apr 2012 14:45:58 +0200 (CEST) Received: by tionne.local (Postfix, from userid 500) id 2607B20D11; Wed, 11 Apr 2012 14:45:56 +0200 (CEST) From: Moritz Bunkus Date: Wed, 11 Apr 2012 14:45:51 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Mailman-Approved-At: Wed, 11 Apr 2012 12:04:55 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) 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{} << 42 << 54) } , whatever{"broken"} { } }; class Foo: public QThingy { protected: SomeObject thingy; std::string whatever; public: Foo() : thingy( utilityFunction(42, QList << 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 From unknown Fri Aug 22 01:33:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11223: 24.0.94; C++11 initializer lists cause wrong indentation Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 14 Aug 2016 21:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11223 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Moritz Bunkus Cc: 11223@debbugs.gnu.org Received: via spool by 11223-submit@debbugs.gnu.org id=B11223.14712095015028 (code B ref 11223); Sun, 14 Aug 2016 21:19:01 +0000 Received: (at 11223) by debbugs.gnu.org; 14 Aug 2016 21:18:21 +0000 Received: from localhost ([127.0.0.1]:57612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2nV-0001Ix-JW for submit@debbugs.gnu.org; Sun, 14 Aug 2016 17:18:21 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:37043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2nU-0001Ie-67; Sun, 14 Aug 2016 17:18:20 -0400 Received: by mail-it0-f53.google.com with SMTP id f6so29914006ith.0; Sun, 14 Aug 2016 14:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Gb3agmzV6VHEQA3PKLNt/bFxGQBa/++36PEyhFxHGi4=; b=YmOMSW5wK5Ey7HsyOUgybt9PoHjfvFGkpOEgeNEDdivJTY4H0xu3fQtZ99Smr778yb QI0DeBGUW/NXOg1Zp0c1j0Y1BXgJ9/SKbJnrpq55xSr9aXEMsycivzfTGMRvkRLUEzw5 SbF9WenSvO4Bl+DPWBdjIZ5CB9xMG9Mj4n6wSL5l12exGCRlSIZeALcYTzdEhVxSV3Xr ZCDAFux+UWc49h8BkYf+gccIAHGaxq4Nvp6XSiGAzcXFrgQgKhGxM1KKwCz15/FVGjVT 0om7a+pbmMlmaldUbxH6ZFDnFYi0U3JXKxpw3EsNYqsjhKhPeDjwYcQ2L72QRz1oSwH/ 6bPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Gb3agmzV6VHEQA3PKLNt/bFxGQBa/++36PEyhFxHGi4=; b=U2f7xRTIL//rw+IVhkVa+fh4RHO++1HVVVaNEbYnDDdEw9qCe5xt10FIUOV3KtjRtr +0vvyCsNVuTUVnDG/ebdKW4zqKsUoaSUTgmwm+YKtNASss/Bc0BthH9VfUts6op7pl/u nkbwHOzUSBKHFeEo5Y+DR8tEn8+YOkiz4OYb1IBe07XaX4Ol+wLLhyHgEcQ72hZcF6w3 9b9O88Dc65RKrCel+DigkOdJ+kfHabdi19wLd8Ctx4ZonSvmSjuaeGB654YvIEjlb1e3 WkLfTXvhK8yz9BLECXOw+sfpGP4uo694B59BHiwLpYV9tZ7k3sVNaMA8TjwvajNEJsXk AQPw== X-Gm-Message-State: AEkoous659PTB0UCWX/cRhlqpoTWvIOq7WmLIVFz4U/Rukw4tP1Vr5UvWddHaXDIH1apng== X-Received: by 10.36.253.194 with SMTP id m185mr10652884ith.2.1471209494559; Sun, 14 Aug 2016 14:18:14 -0700 (PDT) Received: from lylat (S01061859339e9903.ss.shawcable.net. [174.2.107.88]) by smtp.gmail.com with ESMTPSA id t35sm8442411ioi.7.2016.08.14.14.18.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Aug 2016 14:18:14 -0700 (PDT) From: Alex References: Date: Sun, 14 Aug 2016 15:18:12 -0600 In-Reply-To: (Moritz Bunkus's message of "Wed, 11 Apr 2012 14:45:51 +0200") Message-ID: <87wpjjoxrf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) close 24.5 quit Moritz Bunkus 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{} << 42 << 54) } > , whatever{"broken"} > { > } > }; > > class Foo: public QThingy { > protected: > SomeObject thingy; > std::string whatever; > public: > Foo() > : thingy( utilityFunction(42, QList << 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 14 17:21:38 2016 Received: (at control) by debbugs.gnu.org; 14 Aug 2016 21:21:38 +0000 Received: from localhost ([127.0.0.1]:57629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2qg-0001Oi-91 for submit@debbugs.gnu.org; Sun, 14 Aug 2016 17:21:38 -0400 Received: from mail-it0-f50.google.com ([209.85.214.50]:38253) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2qe-0001OW-QK for control@debbugs.gnu.org; Sun, 14 Aug 2016 17:21:37 -0400 Received: by mail-it0-f50.google.com with SMTP id i128so1478474itf.1 for ; Sun, 14 Aug 2016 14:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version; bh=m8w25aBqxez+UozrXDUArOpV8BQ3gF2Q3OyId2LjZnk=; b=KDkeKjm4/4KLaCPkd8Y2r2ASydfrzp1odb5GHMYuG0VOhVvpa2A9xJT1rFXm92sO61 y4hPMsVFgZZLVAxi4f2s5aRtvTWFGzmmyjgVJzQIyuvzBsu/CPL3qTJ3lsBau3tJXaLD FNMF5dvxikNpm/mDZEYqmj3Osvqiga4eXNn1KTRBsM1ILkSfdbPHti1p//eqftqpK7h5 FdpxBWMWjX+plurj2RU2OptuMFxX39JBjxZOev7Cw7Rn6LYhzdAFKiuuBX825X+h54DI FiVzY9suR/AO39YN7Pi0P2uOeRd5nzwitqSNC/MPET4GUHq28YojRlH5xCZ5XSfXiXGq 75dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=m8w25aBqxez+UozrXDUArOpV8BQ3gF2Q3OyId2LjZnk=; b=hsReAt9ff6MTP3q+dRrQ1p8feSSXuokJF/qp7e+593VWdNlBqAucrzSXkXmkIbFH8K WpoJEGXj4vVXerwYKtyO65vN41t7r9IlqzL4X3pPpDeduYaD8Ec9NxKxqhlYk3kLnF/x B8DVUYoUODdgcBGgkhcgSA12eveRjQpkZB874zQWw4n2jEFqyWJCUOjALQvUrQufsEIx PpQW2j2rG16Q08oF3wicZ3c3rgt6EWmdyctB8obG0H97AMBqXPH4VLuGaz55wEVv1yxR 44IrTsfjNr420YZW6PzrYVJghMYxI4VMN4v9fGFfN+//sS5LThUMr03J7V/towPX2PIY q9Ug== X-Gm-Message-State: AEkooutvZJvwY4cpvFXvhnwcBWTafd1MnlUyzjkeHCjhqolZMQam3oFvWXYUwTzd2dMelg== X-Received: by 10.36.70.193 with SMTP id j184mr9915180itb.39.1471209691360; Sun, 14 Aug 2016 14:21:31 -0700 (PDT) Received: from lylat (S01061859339e9903.ss.shawcable.net. [174.2.107.88]) by smtp.gmail.com with ESMTPSA id z128sm8495402iof.4.2016.08.14.14.21.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Aug 2016 14:21:31 -0700 (PDT) From: Alex To: control@debbugs.gnu.org Subject: close bug#11223 Date: Sun, 14 Aug 2016 15:21:29 -0600 Message-ID: <87shu7oxly.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) close 11223 24.5 quit Sorry, I forgot the bug number.