Subject: 27.2; cc-mode and constexpr if

From: John Eivind Helset <[email-masked]>
Date: Wed, 26 May 2021 05:08:03 +0200

cc-mode has problems with constexpr-if-statements whose true-statement
is not a compound statement.

>From 'emacs -Q' open a buffer in cc-mode and compare the formatting of:

void f(){
  if(a == 4)
    return 4;
  else if(a == 3)
    return 3;
  else
    return 2;
}

void f_constexpr(){
  if constexpr(a == 4)
                return 4;
  else if constexpr(a == 3)
         return 3;
  else
    return 2;
}

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4)
 of 2021-03-26 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Arch Linux

Recent messages:
Loading /home/jeh/.config/emacs/custom.el (source)...done
Turning on magit-auto-revert-mode...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Package cl is deprecated

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int
 --with-modules --with-cairo --with-harfbuzz 'CFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  linum-mode: t
  show-paren-mode: t
  projectile-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  counsel-mode: t
  ivy-mode: t
  company-mode: t
  shell-dirtrack-mode: t
  minibuffer-depth-indicate-mode: t
  mood-line-mode: t
  winner-mode: t
  whole-line-or-region-global-mode: t
  whole-line-or-region-local-mode: t
  delete-selection-mode: t
  global-auto-revert-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/jeh/.config/emacs/elpa/cmake-mode-20210104.1831/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode

Features:
(shadow sort mail-extr emacsbug company-oddmuse company-keywords
company-etags etags fileloop company-gtags company-dabbrev-code
company-dabbrev company-files company-clang company-capf company-cmake
company-semantic company-template company-bbdb linum systemd conf-mode
elfeed-show elfeed-search magit-bookmark bookmark pp shr svg dom
elfeed-csv elfeed elfeed-curl elfeed-log elfeed-db elfeed-lib avl-tree
generator url-queue xml-query xml nnfolder nnoo nnmail gnus-int
gnus-range mail-source gnus wid-edit nnheader smtpmail sendmail smime
dig cal-menu calendar cal-loaddefs circe lui-irc-colors irc lcs
lui-format lui tracking shorten paren flyspell ispell circe-compat
projectile-vterm projectile skeleton ibuf-macs find-dired grep ibuf-ext
ibuffer ibuffer-loaddefs vterm face-remap term ehelp find-func
vterm-module term/xterm xterm forge-list forge-commands forge-semi
forge-bitbucket buck forge-gogs gogs forge-gitea gtea forge-gitlab glab
forge-github ghub-graphql treepy gsexp ghub let-alist gnutls
forge-notify forge-revnote forge-pullreq forge-issue forge-topic
bug-reference forge-post markdown-mode noutline outline forge-repo forge
forge-core forge-db closql emacsql-sqlite emacsql emacsql-compiler
url-http url-auth url-gw nsm url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func imenu
magit-diff git-commit log-edit message rmc puny rfc822 mml mml-sec epa
derived epg epg-config gnus-util rmail rmail-loaddefs
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
magit-margin magit-transient magit-process with-editor server magit-mode
transient magit-git magit-section magit-utils crm dash counsel xdg xref
project dired dired-loaddefs swiper ivy ivy-faces ivy-overlay colir
company-jedi jedi-core python-environment epc ctable concurrent deferred
company make-mode cmake-mode thingatpt rst compile cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
python tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete parse-time iso8601 time-date ls-lisp
format-spec comint web-mode advice disp-table adoc-mode tempo cl
markup-faces mb-depth pinentry modus-vivendi-theme modus-themes pcase
mood-line winner ring vc vc-dispatcher smerge-mode diff-mode diff
whole-line-or-region rainbow-mode ansi-color color edmacro kmacro delsel
autorevert filenotify cl-extra help-mode use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core finder-inf rx info package easymenu
browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 557252 409165)
 (symbols 48 41880 568)
 (strings 32 164504 45552)
 (string-bytes 1 4903026)
 (vectors 16 61227)
 (vector-slots 8 754212 496078)
 (floats 8 454 1083)
 (intervals 56 408 112)
 (buffers 1000 11))

-- 
John Eivind Helset