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

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

bug#15415: 24.3.50; c++-mode fontification for constructors is inconsist


From: Ivan Andrus
Subject: bug#15415: 24.3.50; c++-mode fontification for constructors is inconsistent
Date: Sun, 29 Sep 2013 21:31:13 -0600

Ivan Andrus <address@hidden> writes:

> Font locking of C++ constructors is somewhat inconsistent.  This is no
> doubt complicated by the fact that unlike other function declarations
> they "don't have a return type".
>
> When a single argument is not used but named, the constructor is not
> fontified (normally it's fontified with `font-lock-function-name-face').
> If the keyword explicit is used, then the argument type is fontified as
> a variable, and the constructor name is fontified as a type.  Perhaps
> interestingly, naming the parameter or adding another parameter causes
> fontification to work correctly (with or without explicit).
>
> I have included a sample file below with comments on what I see in `emacs -q`
>
>
> class Bob
> {
>     // string is `font-lock-type-face', Bob is `font-lock-function-name-face'
>     Bob( string bob );
>     // string and Bob are not fontified (though I sometimes see string 
> fontified as a type)
>     Bob( string );
>     // string is `font-lock-variable-name-face', Bob is `font-lock-type-face'
>     explicit Bob( string );
>     // string is `font-lock-type-face', Bob is `font-lock-function-name-face'
>     explicit Bob( string, string );
> };

In fact, it's not just constructors that have this problem.  For example
the following function declaration:

string lookup( size_t ) const;

Removing const, or adding a name to the size_t parameter causes
fontification to work correctly.

-Ivan





reply via email to

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