-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Environment
- OS and Version: Linux x64 5.14.21-150400.24.38-default
- VS Code Version: 1.74.0
- C/C++ Extension Version: 1.13.9
Bug Summary and Steps to Reproduce
Bug Summary:
C typedef statement may not be parsed correctly if it is using brackets (...) to influence precedence of language tokens. Example is this simple C program:
typedef uint16_t (*func_ptr) (void);
void main (void)
{
uint16_t count;
func_ptr f;
count = 0;
f = NULL;
}Per C language rules, this typedef defines the new type 'func_ptr', which is a pointer to a function that returns uint16_t. Brackets around it are important as otherwise the new type will be interpreted as definition of type of a function that returns uint16_t *.
But cpptools are apparently confused by this extra brackets and decide that this typedef redefines the uint16_t.
Attached picture shows that because of the above misinterpretation the local variable count is colored as a function. What obviously is incorrect as count is a local variable, not a function.
Expected behavior:
countmust be colored as a local variable- In the above program, invoking action "Go to type definition" on
uint16_twill take to the line 1. This must not happen as that line does NOT define this type
Configuration and Logs
Pretty much vanilla config.Other Extensions
No response
Additional context
No response
