Subject: bug#23610: 25.0.94; c++-mode doesn't fontify typename... like typename

From: Alan Mackenzie <[email-masked]>
Date: Thu, 30 Jun 2016 14:36:36 +0000

Hello, Ivan.

On Wed, Jun 22, 2016 at 09:22:01AM -0600, Ivan Andrus wrote:
> On Sun, Jun 19, 2016 at 3:14 PM, Alan Mackenzie <[email-masked]> wrote:
> > In article <[email-masked]> you wrote:
> >> Starting with emacs -Q, Y is not fontified in the snippet below, whereas
> >> X is.

> >> -Ivan

> >> template <typename X, typename... Y>
> >> class bob {

> >> };

> > [ .... ]

> > The following patch is a first attempt to fontify parameter packs.  After
> > applying it, please be sure either to recompile CC Mode entirely, or
> > first to compile cc-langs.el (which contains macros), and then all three
> > of cc-fonts.el, cc-engine.el, and cc-mode.el.

> > It seems to fontify the "Y" above OK.  I've tried it on a stock example
> > out of Wikipedia, and that works.  Could you try it out on your code,
> > please, and let me know how well it works.

> It looks pretty good.  I didn't notice this before, but the following example
> from Wikipedia is fontified differently if the ... is removed from before the
> `args`.  In that case args is fontified with `font-lock-variable-name-face`.

>   template<typename... Args> inline void expand(Args&&... args) {
>     pass( some_function(args)... );
>   }

What is this "&&" operator?  It cannot be a logical and, and doesn't look
like anything to do with a move constructor.  I've tried, and failed, to
find an explanation in http://en.cppreference.com/w/cpp/language.  I
didn't find and explanation in the article "variadic templates" in
wikipedia either.  A pointer to a web page explaining it would be much
appreciated.

I'm tempted to commit the patch as it is at the moment, but feel I ought
to understand this "&&" first.

> FWIW, I've seen similar mis-fontifications before (without ...) and it hasn't
> bothered me too much.  I just found a reproducible case, so I guess I'll
> open a bug for it.

> Thanks for working on this.  The raw string support is awesome!

Thanks!  There've recently been one or two bugs fixed for raw string
support.  The corrections are in the Emacs master branch.

> -Ivan

-- 
Alan Mackenzie (Nuremberg, Germany).