Subject: bug#13367: closed (Re: bug#13367: 24.1; Wrong switch/case indentation inside some c++11 lambdas)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 30 Sep 2019 16:42:02 +0000

Your bug report

#13367: 24.1; Wrong switch/case indentation inside some c++11 lambdas

which was filed against the emacs,cc-mode package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13367: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13367
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13367: 24.1; Wrong switch/case indentation inside some c++11 lambdas
From: Stefan Kangas <[email-masked]>
To: Denis Zalevskiy <[email-masked]>
Cc: Alan Mackenzie <[email-masked]>, [email-masked]
Date: Mon, 30 Sep 2019 18:40:59 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Denis Zalevskiy <[email-masked]> writes:

> Just create c++ file and enter:
>
> #include <vector>
> #include <algorithm>
>
> int main()
> {
>     std::vector<int> v;
>     std::for_each(v.begin(), v.end(),
>                   [](int i) {
>                       switch (i) {
>                       case 1:
>                           break; // (1) ok: syntactic symbol is statement-case-intro
>                       }
>                   });
>     auto fn = [](int i) {
>         switch (i) {
>         case 1:
>         break;  // (2) wrong: syntactic symbol is brace-list-entry
>         }
>     };
>
>     [](int i) {
>         switch (i) {
>         case 1:
>             break; // (3) ok: syntactic symbol is statement-case-intro
>         }
>     };
>     return 0;
> }
>
> So, while (1) and (3) are parsed fine, (2) is parsed in a wrong way.

I can't reproduce this on current master, so I'm going to assume that
this has been fixed in the 6 years since this was reported and close
this bug.

If this is still an issue, please reopen the bug report.

Best regards,
Stefan Kangas

Subject: 24.1; Wrong switch/case indentation inside some c++11 lambdas
From: Denis Zalevskiy <[email-masked]>
To: [email-masked]
Date: Sun, 06 Jan 2013 14:02:22 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Just create c++ file and enter:

#include <vector>
#include <algorithm>

int main()
{
    std::vector<int> v;
    std::for_each(v.begin(), v.end(),
                  [](int i) {
                      switch (i) {
                      case 1:
                          break; // (1) ok: syntactic symbol is statement-case-intro
                      }
                  });
    auto fn = [](int i) {
        switch (i) {
        case 1:
        break;  // (2) wrong: syntactic symbol is brace-list-entry
        }
    };

    [](int i) {
        switch (i) {
        case 1:
            break; // (3) ok: syntactic symbol is statement-case-intro
        }
    };
    return 0;
}

So, while (1) and (3) are parsed fine, (2) is parsed in a wrong way.

In GNU Emacs 24.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.13)
 of 2012-11-18 on buildvm-30.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11204000
Configured using:
 `configure '--build=x86_64-redhat-linux-gnu'
 '--host=x86_64-redhat-linux-gnu' '--program-prefix='
 '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
 '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include'
 '--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
 '--localstatedir=/var' '--sharedstatedir=/var/lib'
 '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus'
 '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
 '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' '--with-gpm=no'
 '--with-wide-int' 'build_alias=x86_64-redhat-linux-gnu'
 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
 --param=ssp-buffer-size=4 -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: C++/l

Minor modes in effect:
  recentf-mode: t
  shell-dirtrack-mode: t
  helm-match-plugin-mode: t
  erc-track-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-match-mode: t
  erc-log-mode: t
  erc-list-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  global-hl-line-mode: t
  global-ede-mode: t
  erc-nick-notify-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-keep-place-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  diff-auto-refine-mode: t
  dtrt-indent-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<return> <tab> r e t u M-x q t - c p <tab> <return> 
<tab> r n SPC 0 ; <up> <return> <tab> s t d : : v e 
c t o r < i n m > <backspace> <backspace> t > SPC i 
<backspace> v ; <return> <tab> f o r <backspace> <backspace> 
<backspace> s t d : : f o r _ e a c h * ( ) <left> 
<left> <backspace> <right> v . b e g i n ( ) , SPC 
v . e n d ( ) , SPC [ ] <left> <left> <backspace> <return> 
<tab> <right> <right> ( ) SPC { <return> <tab> } <up> 
C-e <left> <left> <left> i n t SPC i <right> <right> 
<right> <down> ; <up> C-e <return> <tab> s w i t c 
h SPC ( i ) SPC { <return> } <up> C-e <return> <tab> 
c a s e SPC 1 : <return> <tab> b r e a k ; C-c C-o 
C-g <return> <tab> d e f a u l t : C-a C-SPC <down> 
C-w C-x C-s <up> <up> <up> <up> <up> C-SPC C-g <down> 
<down> <down> <down> <down> <down> C-e <return> <tab> 
a u t o SPC f n SPC = SPC p [ <backspace> <backspace> 
p [ <backspace> <backspace> p [ <backspace> <backspace> 
[ ] ( ) SPC { <return> { <backspace> } ; <up> <up> 
<down> <C-right> <C-right> <C-right> <up> <up> C-e 
<left> <left> <left> i n t SPC i <up> <up> <up> <up> 
<up> C-a C-SPC <down> <down> <down> <down> M-w <down> 
<down> C-y <up> <up> <up> <up> <tab> <down> <tab> <down> 
<tab> <down> <tab> <down> <tab> <up> <up> <up> C-x 
C-s M-x r e p o r t - e m a c s - b u <tab> <retur
n>

Recent messages:
Auto-saving...done
Quit
Mark set
Saving file /home/denis/src/tmp/test.cpp...
Wrote /home/denis/src/tmp/test.cpp
Mark set
Quit
Mark set [2 times]
Saving file /home/denis/src/tmp/test.cpp...
Wrote /home/denis/src/tmp/test.cpp

Load-path shadows:
/home/denis/emacs/cedet/lisp/speedbar/loaddefs hides /home/denis/emacs/cedet/lisp/eieio/loaddefs
/home/denis/emacs/cedet/lisp/speedbar/loaddefs hides /home/denis/emacs/cedet/lisp/cedet/loaddefs
~/emacs/misc/rpm-spec-mode hides /usr/share/emacs/site-lisp/rpm-spec-mode
~/emacs/misc/cmake-mode hides /usr/share/emacs/site-lisp/cmake/cmake-mode
/home/denis/emacs/cedet/lisp/speedbar/speedbar hides /usr/share/emacs/24.1/lisp/speedbar
/home/denis/emacs/cedet/lisp/common/ezimage hides /usr/share/emacs/24.1/lisp/ezimage
/home/denis/emacs/cedet/lisp/speedbar/loaddefs hides /usr/share/emacs/24.1/lisp/loaddefs
/home/denis/emacs/cedet/lisp/speedbar/dframe hides /usr/share/emacs/24.1/lisp/dframe
/home/denis/emacs/cedet/lisp/speedbar/sb-image hides /usr/share/emacs/24.1/lisp/sb-image
~/emacs/misc/whitespace hides /usr/share/emacs/24.1/lisp/whitespace
~/emacs/magit/.dir-locals hides /usr/share/emacs/24.1/lisp/gnus/.dir-locals
/home/denis/emacs/cedet/lisp/eieio/eieio-custom hides /usr/share/emacs/24.1/lisp/emacs-lisp/eieio-custom
/home/denis/emacs/cedet/lisp/eieio/eieio-opt hides /usr/share/emacs/24.1/lisp/emacs-lisp/eieio-opt
/home/denis/emacs/cedet/lisp/eieio/eieio-speedbar hides /usr/share/emacs/24.1/lisp/emacs-lisp/eieio-speedbar
/home/denis/emacs/cedet/lisp/eieio/eieio hides /usr/share/emacs/24.1/lisp/emacs-lisp/eieio
/home/denis/emacs/cedet/lisp/eieio/eieio-datadebug hides /usr/share/emacs/24.1/lisp/emacs-lisp/eieio-datadebug
/home/denis/emacs/cedet/lisp/eieio/eieio-base hides /usr/share/emacs/24.1/lisp/emacs-lisp/eieio-base
/home/denis/emacs/cedet/lisp/eieio/chart hides /usr/share/emacs/24.1/lisp/emacs-lisp/chart

Features:
(shadow emacsbug newcomment novice etags shr-color color nnimap
parse-time utf7 gnus-art mm-uu mml2015 gnus-sum nnoo gnus-group
gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range
gnus-win shr rfc2104 gnutls network-stream starttls mailalias smtpmail
sendmail qp sort mail-extr mule-util rot13 disp-table multi-isearch
tabify man dabbrev ede/dired filecache recentf tree-widget helm-files
image-dired tramp tramp-compat shell tramp-loaddefs dired-x dired-aux
ffap helm-tags helm-bookmark helm-adaptative helm-info helm-net
browse-url xml url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-util url-parse auth-source url-vars
helm-plugin bookmark helm-locate helm-help helm-match-plugin helm-grep
helm-buffers helm-elscreen helm-regexp grep helm-external helm-utils
dired helm auctex-autoloads tex-site muse-autoloads sb-info info package
tabulated-list saveplace erc-track erc-ring erc-networks erc-netsplit
erc-menu erc-match erc-log erc-pcomplete pcomplete erc-button erc-fill
erc-stamp erc-join gnus gnus-ems nnheader gnus-util whitespace sauron
coffee-mode clojurescript-mode clojure-mode rx yaml-mode cmake-mode
offlineimap notmuch hl-line notmuch-message notmuch-maildir-fcc
notmuch-hello notmuch-show notmuch-print notmuch-crypto notmuch-mua
notmuch-address notmuch-wash coolj notmuch-query goto-addr icalendar
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs notmuch-tag crm
notmuch-lib json message rfc822 mml mailabbrev mail-utils gmm-utils
mailheader mm-view mml-smime mml-sec smime password-cache dig mm-decode
mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr ecb ecb-symboldef ecb-analyse
ecb-compatibility ecb-winman-support ecb-autogen autoload ecb-tod
ecb-cycle ecb-eshell ecb-help ecb-jde ecb-method-browser hideshow
ecb-semantic ecb-file-browser ecb-speedbar ecb-layout compile comint
ansi-color ecb-create-layout ecb-compilation ecb-common-browser
ecb-navigate ecb-mode-line ecb-face tree-buffer ecb-upgrade
ecb-cedet-wrapper semantic/db-mode semantic/db-find semantic/db-ref
ecb-util silentcomp semantic/dep vc-git ede/cpp-root ede/emacs
ede/java-root cedet-devel-load warnings eieio-opt find-func help-mode
srecode/map srecode semantic/canned-configs semantic/ia-sb
semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn
semantic/db semantic/ctxt semantic/format semantic/tag-ls semantic/find
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet-compat inversion ede/speedbar ede/files ede
ede/base ede/auto ede/source eieio-base eieio-speedbar speedbar pulse
sb-image ezimage dframe eieio-custom cedet eieio cedet-remove-builtin
go-mode-load protobuf-mode byte-opt bytecomp byte-compile cconv macroexp
cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds column-marker
cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt xcscope
helm-config eudcb-ldap netrc eudc cus-edit cus-start cus-load eudc-vars
wid-edit ldap tls znc erc-nick-notify erc-goodies erc erc-backend
erc-compat format-spec thingatpt pp magit-bisect magit-key-mode assoc
magit server esh-var esh-io esh-cmd esh-ext esh-proc esh-arg eldoc
esh-groups eshell esh-module esh-mode esh-util edmacro kmacro ediff-merg
ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff
ido iswitchb view diff-mode log-edit easymenu ring pcvs-util add-log cl
dtrt-indent advice help-fns advice-preload easy-mmode epa-file epa
derived epg epg-config time-date paren my-site-start tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)