From unknown Fri Jun 20 07:14:52 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#48670 <48670@debbugs.gnu.org> To: bug#48670 <48670@debbugs.gnu.org> Subject: Status: 27.2; cc-mode and constexpr if Reply-To: bug#48670 <48670@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:14:52 +0000 retitle 48670 27.2; cc-mode and constexpr if reassign 48670 emacs submitter 48670 John Eivind Helset severity 48670 normal tag 48670 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Wed May 26 10:41:10 2021 Received: (at submit) by debbugs.gnu.org; 26 May 2021 14:41:10 +0000 Received: from localhost ([127.0.0.1]:49693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lluib-0000DB-RX for submit@debbugs.gnu.org; Wed, 26 May 2021 10:41:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:38748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lljvH-0002zv-NG for submit@debbugs.gnu.org; Tue, 25 May 2021 23:09:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lljvH-0001Ge-IR for bug-gnu-emacs@gnu.org; Tue, 25 May 2021 23:09:31 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]:38564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lljvF-0000HA-Fb for bug-gnu-emacs@gnu.org; Tue, 25 May 2021 23:09:31 -0400 Received: by mail-lj1-x235.google.com with SMTP id a4so26018097ljd.5 for ; Tue, 25 May 2021 20:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=qNwZZueR8GCzaHO+o0cj9v8mItIKQXTlMsoGngUjaRY=; b=K228F2zOs5vY8W05fnD5j9s+roci5NMyX04vbph+gsIKrHqZT2B8waWOHXZpoVQxEd BPxnU7ypcDx+qNoZgEsYvVWcwoSgdMpoSAzC+FOSmpcmehN5HFXnTekeIWSQ1ph0dXIg CcgMJqEJLf6X8WXL/vRmoJXCOzq73OlGfaHclGxvqkg53QdWt/LurF+Uq+a4KKytSWi9 krhohu3eZDOuNrmoT1XMax4p0TsDW8ZY8uHOx/LpAyOG8VNTXpY4Jb8JnPYDLq6Boos7 z7J3ph6tgPuiOpxFX9nBQ3auVDVE4DLNAOFuyvhMsDX+Y2eKORJq0fA9ZGU2AHBjN+we bckQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=qNwZZueR8GCzaHO+o0cj9v8mItIKQXTlMsoGngUjaRY=; b=J2xd9MnZEVgFhYQxJOrLCQZHGtDBdhpGx05LRxN6/xioOuFDqZKu73cP0Dwsd3yNJ8 PB9NZcGfIWpUNqMe0zVE7G0Ceqq311dG8tDqeTo0i/982uX3IeSOfH9SxBTfD6JWvVo7 SVCYiFk0m5JZQ1zThog9H6aqAdq9kcWGz8cQTU9ab3J8ZaRTld9ryi9Rmm47HZqo6FJ7 Holcizjg0UGQQ0NUEmEp0E1MFL7yABfJkymiwjcY7gMY1IT3KKt9HHyORrjWCvfAVmA8 PpryUNQ9/8gUZEVLJr+L7dyUbfHodorQsB8/sQtEURy6VKNSXl4an9fxbLeejTZoiCm2 BC8w== X-Gm-Message-State: AOAM533GhRiKXzBFj5Bme8vMEfaVoGnqZYfAWeLJiEVkJ4eLn5ya3uMT MhSlSZTHUv+pvdMOXGfAeCeu2T2fFkU= X-Google-Smtp-Source: ABdhPJyMcQJADfs2fWcpgZWcqdbaKvTyJqYtWoH3WTUqtMKsGUul/QlRWuL0LMH0P4FLRqwBSOZbOg== X-Received: by 2002:a2e:8297:: with SMTP id y23mr540732ljg.410.1621998566479; Tue, 25 May 2021 20:09:26 -0700 (PDT) Received: from boromir (cm-84.209.80.117.getinternet.no. [84.209.80.117]) by smtp.gmail.com with ESMTPSA id i8sm1899176lfd.12.2021.05.25.20.09.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 20:09:26 -0700 (PDT) From: John Eivind Helset To: bug-gnu-emacs@gnu.org Subject: 27.2; cc-mode and constexpr if Date: Wed, 26 May 2021 05:08:03 +0200 Message-ID: <87lf8242gc.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=jehelset@gmail.com; helo=mail-lj1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 26 May 2021 10:41:08 -0400 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: -2.3 (--) 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 From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 12:29:43 2021 Received: (at 48670) by debbugs.gnu.org; 30 May 2021 16:29:43 +0000 Received: from localhost ([127.0.0.1]:60251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnOJc-0002yh-PX for submit@debbugs.gnu.org; Sun, 30 May 2021 12:29:43 -0400 Received: from colin.muc.de ([193.149.48.1]:62030 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lnOJY-0002yQ-VS for 48670@debbugs.gnu.org; Sun, 30 May 2021 12:29:27 -0400 Received: (qmail 73190 invoked by uid 3782); 30 May 2021 16:29:18 -0000 Received: from acm.muc.de (p2e5d5a0f.dip0.t-ipconnect.de [46.93.90.15]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 30 May 2021 18:29:17 +0200 Received: (qmail 19695 invoked by uid 1000); 30 May 2021 16:29:17 -0000 Date: Sun, 30 May 2021 16:29:17 +0000 To: John Eivind Helset Subject: Re: bug#48670: 27.2; cc-mode and constexpr if Message-ID: References: <87lf8242gc.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lf8242gc.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 48670 Cc: acm@muc.de, 48670@debbugs.gnu.org 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: -1.0 (-) Hello, John. On Wed, May 26, 2021 at 05:08:03 +0200, John Eivind Helset wrote: > 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; > } Thanks for taking the trouble to report this bug, and thanks even more for creating a minimal, easy to work with, test case. The bug has in fact already been fixed in the development version of Emacs, and should be getting released with Emacs 28.1, whenever that will happen. In the mean time, please apply the following patch to ..../emacs/lisp/progmodes/cc-engine.el, and then byte compile that file. Should you want any help with the patching or byte compilation, feel free to send me private email. --- cc-engine.el.orig 2021-05-30 16:08:48.855885223 +0000 +++ cc-engine.el 2021-05-30 16:16:47.785903083 +0000 @@ -1181,6 +1181,15 @@ ;; suitable error. (setq pre-stmt-found t) (throw 'loop nil)) + ;; Handle C++'s `constexpr', etc. + (if (save-excursion + (and (looking-at c-block-stmt-hangon-key) + (progn + (c-backward-syntactic-ws lim) + (c-safe (c-backward-sexp) t)) + (looking-at c-block-stmt-2-key) + (setq pos (point)))) + (goto-char pos)) (cond ;; Have we moved into a macro? ((and (not macro-start) > 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 [ .... ] > -- > John Eivind Helset -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 12:35:19 2021 Received: (at 48670) by debbugs.gnu.org; 30 May 2021 16:35:19 +0000 Received: from localhost ([127.0.0.1]:60259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnOPH-00038S-GW for submit@debbugs.gnu.org; Sun, 30 May 2021 12:35:19 -0400 Received: from colin.muc.de ([193.149.48.1]:62175 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lnOPF-000386-67 for 48670@debbugs.gnu.org; Sun, 30 May 2021 12:35:17 -0400 Received: (qmail 78074 invoked by uid 3782); 30 May 2021 16:35:11 -0000 Received: from acm.muc.de (p2e5d5a0f.dip0.t-ipconnect.de [46.93.90.15]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 30 May 2021 18:35:11 +0200 Received: (qmail 19720 invoked by uid 1000); 30 May 2021 16:35:10 -0000 Date: Sun, 30 May 2021 16:35:10 +0000 To: control@debbugs.gnu.org Subject: Re: bug#48670: 27.2; cc-mode and constexpr if Message-ID: References: <87lf8242gc.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lf8242gc.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 48670 Cc: 48670@debbugs.gnu.org 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: -1.0 (-) tags 48670 fixed 28.1 close 48670 quit On Wed, May 26, 2021 at 05:08:03 +0200, John Eivind Helset wrote: > cc-mode has problems with constexpr-if-statements whose true-statement > is not a compound statement. [ .... ] -- Alan Mackenzie (Nuremberg, Germany). From unknown Fri Jun 20 07:14:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 28 Jun 2021 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator