Bug 525722 - Constructor incorrectly parsed as field
Summary: Constructor incorrectly parsed as field
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-07 16:51 EDT by Nathan Ridge CLA
Modified: 2020-09-04 15:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2017-10-07 16:51:21 EDT
In this code:

struct x {};
struct y {
    y(x) {};
};

the declaration inside 'y' is a constructor definition, followed by a stray semicolon (which is allowed).

However, CDT parses it as a field declaration (judging by the fact that it syntax-colors the 'x' as a field rather than a class type).

If you remove the stray semicolon, the declaration is parsed correctly.