aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2021-03-03 11:55:51 +0000
committerAlan Mackenzie2021-03-03 11:55:51 +0000
commit9ef8a3bfca192777e7cf8b4748d188249a517582 (patch)
treee758782340387e39a09347746f1a1103a0813354
parent3ef6d04dcff86a7e2ed6552c1835b24d5bfc58b7 (diff)
downloademacs-9ef8a3bfca192777e7cf8b4748d188249a517582.tar.gz
emacs-9ef8a3bfca192777e7cf8b4748d188249a517582.zip
C++ Mode: Handle "if constexpr (...)" with a simple statement correctly
* 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.
-rw-r--r--lisp/progmodes/cc-engine.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 079985a6bc5..5a8b2f4f906 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1184,6 +1184,15 @@ comment at the start of cc-engine.el for more info."
1184 ;; suitable error. 1184 ;; suitable error.
1185 (setq pre-stmt-found t) 1185 (setq pre-stmt-found t)
1186 (throw 'loop nil)) 1186 (throw 'loop nil))
1187 ;; Handle C++'s `constexpr', etc.
1188 (if (save-excursion
1189 (and (looking-at c-block-stmt-hangon-key)
1190 (progn
1191 (c-backward-syntactic-ws lim)
1192 (c-safe (c-backward-sexp) t))
1193 (looking-at c-block-stmt-2-key)
1194 (setq pos (point))))
1195 (goto-char pos))
1187 (cond 1196 (cond
1188 ;; Have we moved into a macro? 1197 ;; Have we moved into a macro?
1189 ((and (not macro-start) 1198 ((and (not macro-start)