all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ryan Johnson <scovich@gmail.com>
To: 22864@debbugs.gnu.org
Subject: bug#22864: C++11 code causes lisp errors in cc-mode and delete-selection-mode
Date: Mon, 29 Feb 2016 15:49:16 -0700	[thread overview]
Message-ID: <56D4CAEC.3080004@gmail.com> (raw)

The following (lexically valid) C++11 code confuses cc-mode, causing 
lisp errors that interrupt syntax highlighting and which break 
delete-selection-mode:

$ cat font-lock-bug.cpp
void a()
{
    auto b = [](int c) { return c < 0; };
    d({b});
}

The above seems to be near-minimal: erasing either line in the body of 
`a` seems to avoid the problem. The bug affects both the Ubuntu 24.3.1 
build I normally use and a hand-compiled 24.5.1 build.

$ emacs -Q \
    --eval "(setq font-lock-support-mode nil)" \
    --eval "(toggle-debug-on-error)" \
    font-lock-bug.cpp

Invoking the above command immediately triggers the lisp backtrace
below; I did a little source diving in hopes of finding a similar
problem to the one in Bug #21205, but I was unable to penetrate the
code.

Debugger entered--Lisp error: (error "Invalid search bound (wrong side 
of point)")
   signal(error ("Invalid search bound (wrong side of point)"))
   byte-code("... snipped ..." [start err signal] 3)
   c-syntactic-re-search-forward(";" 56 t t)
   byte-code("... snipped ..." [start last-stmt-start lim move
   tentative-move beg c-beginning-of-statement-1 nil t looking-at
   c-backward-sws (59 125 58 nil) -1 "\\s(" macro 123 c-in-knr-argdecl
   throw return previous same syntax-table ((set-syntax-table
   c-with-syntax-table-orig-table)) set-syntax-table c++-mode
   c-syntactic-re-search-forward "[;={]" 61 c-backward-token-2 "[;{]"
   (byte-code "... snipped ..." [nil (byte-code
   "... snipped ..." [scan-lists 1] 4) ((error)) t] 3) ((error)) ";" 
c-opt-method-key c-recognize-knr-p knr-argdecl-start fallback-pos 
c-with-syntax-table-orig-table c-buffer-is-cc-mode c++-template-sy\
ntax-table c-overloadable-operators-regexp c-opt-op-identifier-prefix] 6)
   c-beginning-of-decl-1(1)
   #[(match-pos inside-macro) "... snipped ..." [start-pos
   c-not-decl-init-keywords c-macro-with-semi-re match-pos type context
   get-text-property face font-lock-keyword-face looking-at c-type (40 44
   91 60) nil 40 -1 c-backward-token-2 t arglist c-decl-arg-start decl
   c-<>-arg-sep 60 <> put-text-property c-backward-sws c++-mode
   "\\(more\\)\\([^" "]\\|$\\)" 1 c-forward-sws c-forward-decl-or-cast-1
   cast c-fontify-recorded-types-and-refs skip-syntax-backward "w_" 0
   pike-mode "-!%&*+/<=>^|~[]()" "`" c-decl-type-start c-decl-id-start
   c-font-lock-declarators c-parse-state c-cheap-inside-bracelist-p
   (byte-code "... snipped... " [forward-list t] 1) ((error)) 
c-forward-token-2 41 c-on-identifier c-forward-label ...] 7](52 nil)
   c-find-decl-spots(66
   "[[:alpha:]_]\\|\\(\\(?:::\\|\\?\\?-\\|compl\\>\\|~\\)\\)" (nil
   font-lock-type-face font-lock-constant-face font-lock-keyword-face)
   #[(match-pos inside-macro) "... snipped ..." [start-pos
   c-not-decl-init-keywords c-macro-with-semi-re match-pos type context
   get-text-property face font-lock-keyword-face looking-at c-type (40 44
   91 60) nil 40 -1 c-backward-token-2 t arglist c-decl-arg-start decl
   c-<>-arg-sep 60 <> put-text-property c-backward-sws c++-mode
   "\\(more\\)\\([^" "]\\|$\\)" 1 c-forward-sws c-forward-decl-or-cast-1
   cast c-fontify-recorded-types-and-refs skip-syntax-backward "w_" 0
   pike-mode "-!%&*+/<=>^|~[]()" "`" c-decl-type-start c-decl-id-start
   c-font-lock-declarators c-parse-state c-cheap-inside-bracelist-p
   (byte-code "... snipped..." [forward-list t] 1) ((error)) 
c-forward-token-2 41 c-on-identifier c-forward-label ...] 7])
   c-font-lock-declarations(66)
   font-lock-fontify-keywords-region(1 66 nil)
   font-lock-default-fontify-region(1 66 nil)
   c-font-lock-fontify-region(1 66 nil)
   font-lock-fontify-region(1 66 nil)
   byte-code("... snipped ..." [save-match-data-internal verbose
   font-lock-fontified match-data ((byte-code "... snipped..." 
[save-match-data-internal set-match-data evaporate] 3)) 
font-lock-fontify-region font-lock-after-fontify-buffer t] 4)
   font-lock-default-fontify-buffer()
   font-lock-fontify-buffer()
   font-lock-initial-fontify()
   font-lock-mode()
   turn-on-font-lock()
   turn-on-font-lock-if-desired()
   global-font-lock-mode-enable-in-buffers()
   run-hooks(after-change-major-mode-hook)
   run-mode-hooks(c++-mode-hook)
   c++-mode()
   set-auto-mode-0(c++-mode nil)
   set-auto-mode()
   normal-mode(t)
   after-find-file(nil t)
   find-file-noselect-1(#<buffer font-lock-bug.cpp> 
"~/font-lock-bug.cpp" nil nil "~/font-lock-bug.cpp" (197138636 64256))
   find-file-noselect("/home/ryan/font-lock-bug.cpp" nil nil nil)
   find-file("/home/ryan/font-lock-bug.cpp")
   command-line-1(("--eval" "(setq font-lock-support-mode nil)" "--eval" 
"(toggle-debug-on-error)" "/home/ryan/font-lock-bug.cpp"))
   command-line()
   normal-top-level()

Regards,
Ryan






             reply	other threads:[~2016-02-29 22:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 22:49 Ryan Johnson [this message]
2016-03-01  1:45 ` bug#22864: C++11 code causes lisp errors in cc-mode and delete-selection-mode Óscar Fuentes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D4CAEC.3080004@gmail.com \
    --to=scovich@gmail.com \
    --cc=22864@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.