GNU bug report logs - #57318
29.0.50; c++-mode: Functions are shown as variables: partial template specialization

Previous Next

Package: emacs;

Reported by: Naofumi Yasufuku <naofumi <at> yasufuku.dev>

Date: Sun, 21 Aug 2022 13:28:02 UTC

Severity: normal

Found in version 29.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Naofumi Yasufuku <naofumi <at> yasufuku.dev>
To: 57318 <at> debbugs.gnu.org
Subject: bug#57318: 29.0.50; c++-mode: Functions are shown as variables: partial template specialization
Date: Sun, 28 Aug 2022 14:33:08 +0900
[Message part 1 (text/plain, inline)]
Naofumi Yasufuku <naofumi <at> yasufuku.dev> writes:

> Hello,
>
> In the case of C++ partial template specialization [1], functions are
> shown as variables.  Please look at the attached screenshots.
>
>   1. emacs -Q
>   2. open attached C++ code "specialization.cc"
>
>   attachments:
>   - NG_cc-partial-specialization.png
>   - OK_cc-partial-specialization.png
>   - specialization.cc
>
[..snip..]
>
> After a brief investigation, the attached cc-engine.el patch seems to
> solve this issue at least, but it is not tested enough.
>
>   attachments:
>   - 0001-cc-mode-Fix-function-fontification-in-the-case-of-C-.patch
>

Previous patch still has a problem with sizeof() specializations.
Updated patch and screenshots are attached.

  attachments:
  - 0001-cc-mode-Fix-function-fontification-in-the-case-of-C-v2.patch
  - NG_cc-partial-specialization-v1.png
  - OK_cc-partial-specialization-v2.png
  - specialization.cc

-------------------------------------------------------------
template<typename T1, size_t>
class TwoSz {
public:
    TwoSz() {}
private:
    T1 _t1;
};

template<typename T>
class TwoSz<T, sizeof(int)> {
public:
    TwoSz() {}
private:
    T _t1;
};
-------------------------------------------------------------
$ ./specialization
One<T>: primary
One<char>: specialization
Two<T1, T2>: primary
Two<T, char>: specialization
Two<T, T*>: specialization
Two<T, T&>: specialization
Two<T, T[]>: specialization
Two<char, char*>: specialization
Two<char, char&>: specialization
Two<char, char[]>: specialization
TwoSz<T1, size_t>: primary
TwoSz<T, sizeof(int)>: specialization
$
-------------------------------------------------------------

Best regards,
  Naofumi

[NG_cc-partial-specialization-v1.png (image/png, attachment)]
[OK_cc-partial-specialization-v2.png (image/png, attachment)]
[0001-cc-mode-Fix-function-fontification-in-the-case-of-C-v2.patch (text/x-patch, attachment)]
[specialization.cc (text/plain, attachment)]

This bug report was last modified 2 years and 321 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.