bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57318: 29.0.50; c++-mode: Functions are shown as variables: partial


From: Naofumi Yasufuku
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

Naofumi Yasufuku <naofumi@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

Attachment: NG_cc-partial-specialization-v1.png
Description: sizeof problem

Attachment: OK_cc-partial-specialization-v2.png
Description: ok with patch v2

Attachment: 0001-cc-mode-Fix-function-fontification-in-the-case-of-C-v2.patch
Description: patch v2

Attachment: specialization.cc
Description: test c++ source


reply via email to

[Prev in Thread] Current Thread [Next in Thread]