GNU bug report logs -
#59216
CC Mode 5.35.2 (C++//l); Incorrect fontification of "static key_map *key_map"
Previous Next
Reported by: Po Lu <luangruo <at> yahoo.com>
Date: Sat, 12 Nov 2022 13:10:02 UTC
Severity: normal
Tags: wontfix
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Alan Mackenzie <acm <at> muc.de> writes:
> Hello, Po.
>
> On Sat, Nov 12, 2022 at 21:09:31 +0800, Po Lu via CC-Mode-help wrote:
>> Package: cc-mode
>
>> Go to src/haiku_support.cc. Around line 171, there will be:
>
>> /* The keymap, or NULL if it has not been initialized. */
>> static key_map *key_map;
>
>> the variable name will be fontified as a type!
>
> Er, that's the variable name the same as the type name. Is that valid
> C++? I always thought that types and variables shared a name space.
>
> What am I missing, here?
Here's what the internet says:
According to the C++ standard, declaring a variable with the same name
as a type is correct code in general, but invalid code within a class
definition. The class case is specific, because names declared in a
class definition are visible within the whole class definition, before
and after the point of declaration of that name. In other scopes
(global, namespace, function, ...) declared names are visible only
after the point of declaration.
This bug report was last modified 2 years and 120 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.