Subject: Re: bug#53605: CC Mode 5.35.1 (C++//l); C++11 string literal operator mishighlighted

From: Alan Mackenzie <[email-masked]>
Date: Sat, 29 Jan 2022 11:34:44 +0000

Hello, Richard.

Thanks for the bug report.

On Fri, Jan 28, 2022 at 14:53:20 +0000, Richard Copley wrote:
> Package: cc-mode
> Hi Alan,

> The code below (which is valid since C++11) is mishighlighted,
> with the open-paren after "_opcode" in font-lock-warning face
> and the subsequent characters in font-lock-string-face. This is
> unstable: inserting and deleting a character before the open-
> paren fixes the highlighting, and [M-x normal-mode RET] breaks
> it again.

> <<END
> #include <cstddef>
> int operator""_opcode(const char *p, std::size_t size) {
>   return 0;
> }
> END

It looks like the r""_opcode( has been mistaken for the raw string
delimiter R""_opcode(, and the ( is in warning face because there's no
matching closing delimiter.  case-fold-search ought to be nil here, but
appears not to be.  And the check for the "R" ought to exclude other
alphanumeric characters.

I'll have a closer look at it in the next few days.  I'm a bit short of
time right at the moment.  (Sorry.)

> Emacs  : GNU Emacs 29.0.50 (build 3, x86_64-w64-mingw32)
>  of 2022-01-28 (on master)
> Package: CC Mode 5.35.1 (C++//l)
> Buffer Style: gnu
> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
> gen-string-delim gen-comment-delim syntax-properties 1-bit)

[ .... thanks for the (snipped) status dump! ]

-- 
Alan Mackenzie (Nuremberg, Germany).