Bug 253827

Summary: C++ parser doesn't recognize 'register' keyword.
Product: [Applications] kdevelop Reporter: Jan Kriho <Erbureth>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Severity: wishlist    
Priority: NOR    
Version: 4.0.90   
Target Milestone: 4.1.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Simple testcase

Description Jan Kriho 2010-10-11 13:00:12 UTC
Version:           4.0.90 (using KDE 4.4.6) 
OS:                Linux

In variable declaration c++ parser fails to recognize 'register' as a keyword and considers it an identifier.

Reproducible: Always

Steps to Reproduce:
int register test;

in legal part of a code.
Comment 1 Milian Wolff 2011-07-06 16:01:58 UTC
I cannot even compile this with gcc, can you give a fully compiling example please?
Comment 2 Jan Kriho 2011-07-06 16:53:58 UTC
Sorry about the misinformation, the correct syntax is, of course

register int i;

(compilable with g++ 4.6)

However, the bug is no longer present in 4.2.2, thanks for the fix.
Comment 3 Jan Kriho 2011-07-06 17:02:54 UTC
Created attachment 61647 [details]
Simple testcase

Seems like both examples of syntax are accepted by g++, attaching the testcase for the former example (tested with g++ 4.2 -- 4.6) However, the KDevelop stil doesn't recognize the "int register varname;" syntax.
Comment 4 Jan Kriho 2011-07-06 17:03:56 UTC
Sorry about the confusion, the bug is still present in 4.2.2, as it doesn't accept the syntax accepted by g++
Comment 5 Milian Wolff 2011-07-08 13:51:56 UTC
Git commit 4e7bf7a7c910d3cbf9e34cec7df1a642e2ac7f55 by Milian Wolff.
Committed on 08/07/2011 at 15:51.
Pushed by mwolff into branch 'master'.

support arbitrary order of type-specifier and storage-class-specifier

TODO: we really need to adhere to the spec better by adding a
      parserDeclSpecifier which should solve this problem and others

BUG: 253827

M  +5    -0    languages/cpp/parser/parser.cpp     
M  +9    -0    languages/cpp/parser/tests/test_parser.cpp     
M  +2    -0    languages/cpp/parser/tests/test_parser.h