This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 198276

Summary: Static keyword on local variables
Product: cnd Reporter: thyplosion
Component: Code ModelAssignee: issues@cnd <issues>
Status: REOPENED ---    
Severity: normal    
Priority: P4    
Version: 7.0   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description thyplosion 2011-05-03 10:27:24 UTC
Defining a static variable on a function is not recognized by the editor and an error is issued: "unexpected token static".

ie:

void func()
{
static int localstatic;
}
Comment 1 Alexander Simon 2011-05-03 20:16:16 UTC
Bug is not reproduced on your code example.
It seems error is appeared in previous lines.
Please provide minimal code that has such error.
Comment 2 thyplosion 2011-05-04 08:48:48 UTC
Actually, the error was something else. The real erroneous code is "static var" instead of "static int var". It is the absence of "int" that triggers the error message.

void func()
{
	static catchme = 0;
}

Apologies for having missed this; gcc accepts the code as default "int" type hence I didn't realise the missing keyword.
Comment 3 nnnnnk 2011-05-06 10:16:35 UTC
CSS 4.5.2 says:
main.cpp:14:13: error: ‘catchme’ does not name a type