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.
The C++ parser does not recognize the keyword typeid. The lexer also does not have any token LITERAL_typeid. The following test case does not compile: #include <typeinfo.h> extern "C" int printf(const char*, ...); main() { class A {}; int foo; A bar; printf("%s\n", typeid(foo).name()); printf("%s\n", typeid(bar).name()); } I preproessed this file and edited the preprocessed file to create this small test case: % cat y.c namespace std { class type_info { public : virtual ~ type_info ( ) ; const char * name ( ) const ; const void * __data ; }; } extern "C" int printf ( const char * , ... ) ; main () { class A { }; int foo; A bar; printf("%s\n" , typeid(foo).name()); printf("%s\n" , typeid(bar).name()); } % CC y.c % ./a.out int A % tracemodel.sh y.c y.c:16:3: unexpected token: class y.c:16:9: unexpected token: A
The problem is not with typeid. The problem is that the parser does not recognize the class declaration inside main(). If the declaration of class A is moved outside main, it compiles without errors. But the question still remains: why is there no LITERAL_typeid token in the lexer?
It is fixed and commented in grammar ("cppparser.g", revision 1.2.2.20). Further should be corrected 'AstRenderer'
"unexpected token" was fixed when fixed IZ#83996:Code completion list doesn't appear if enum defined within function (without messages)
Second part of IZ isn't fixed. Keyword "typeid" highlighted as "keyword" but in AST tree it's a CSM_TYPE_COMPOUND with node ID. Grammar should has LITERAL_typeid and represent keyword "typeid" as literal. But it's another (internal design) bug. It should be P4 because it doesn't have influence on user.
close this bug as solved. opened http://www.netbeans.org/issues/show_bug.cgi?id=87618 for investigating typeid support in grammar