]> git.eshelyaron.com Git - emacs.git/commitdiff
C++ Mode: Handle "if constexpr (...)" with a simple statement correctly
authorAlan Mackenzie <acm@muc.de>
Wed, 3 Mar 2021 11:55:51 +0000 (11:55 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 3 Mar 2021 11:55:51 +0000 (11:55 +0000)
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): Add a check and
handling for c-block-stmt-hangon-key in the main loop.

lisp/progmodes/cc-engine.el

index 079985a6bc5fa7b94b8f4f8c04c41907d8bde8d0..5a8b2f4f9060dab0325722fd91cc92cfbc8422f7 100644 (file)
@@ -1184,6 +1184,15 @@ comment at the start of cc-engine.el for more info."
                           ;; 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)