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.
"typeof" is a GCC extension that is equivalent to "decltype" from C++11. It appears that the NetBeans C++ parser doesn't properly recognize this keyword. For example, GCC 4.6.4 successfully complies the following code when using the default standard "gnu++98": <code> #include <iostream> int main() { int x = 3; typeof(x) y = 2; std::cout << (x + y); } </code> However, NetBeans reports a syntax error on line 6: "Unable to resolve identifier x". *** Product Version: NetBeans IDE 8.2 (Build 201609300101) Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 1 Java: 1.8.0_101; Java HotSpot(TM) 64-Bit Server VM 25.101-b13 Runtime: Java(TM) SE Runtime Environment 1.8.0_101-b13 System: Windows 10 version 10.0 running on amd64; Cp1252; en_CA (nb)
Can you, please, provide a compilation command? As far as I know GCC doesn't support typeof extension in C++, only in C. Therefore I'm confused because your test case uses iostream. However, there is a keyword __typeof__ which works both in C and C++. So, I think that we need to add support for typeof into C language and for __typeof__ into both languages. Do you agree?
The commands I'm using to compile and execute are nothing special: g++ main.cpp -o main ./main However, this is on GCC 4.6.4, which is pretty old. I believe "__typeof__" must be used if you're compiling in standards mode, but by default GCC accepts "typeof" as a non-standard extension.
To be clear, though, I believe that GCC indeed supports the "typeof" keyword in C++, not just C.
Fixed at enum: 315028:4b94e16d83c2
Integrated into 'main-silver', will be available in build *201704110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/3b32f280b5fe User: Petr Kudryavtsev <petrk@netbeans.org> Log: Fixed #270231 - typeof keyword not recognized by C++ parser (transplanted from e238ee10b99de88e3e79086cb9d7d8acd2ec82c7) (transplanted from 4b94e16d83c2d117d977b7b3155ebadacfdf7a98)
https://netbeans.org/bugzilla/show_bug.cgi?id=270231 Changesets: http://hg.netbeans.org/releases/rev/4b94e16d83c2 # Fixed #270231 - typeof keyword not recognized by C++ parser http://hg.netbeans.org/releases/rev/090487d610f8 # Additional fix for bug #270231 - typeof keyword not recognized by C++ parser
Verified in NetBeans IDE 8.2 (Build 201704181436)