Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357256

Summary: C++ parser throws StackOverflowError at self-extending class.
Product: [Tools] CDT Reporter: Dominik äger <dominikjaeger>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, vagran.ast
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Log file describing the internal error none

Description Dominik äger CLA 2011-09-09 11:49:17 EDT
Created attachment 203071 [details]
Log file describing the internal error

When opening this snippet of (invalid) C++ code in CDT, a StackOverflowError is thrown:

class A : A
{
};

int main(int, char**)
{
  A a;
  return 0;
}

Instead, an error should brobably be displayed. For example, gcc says:

..\main.cpp:83:1: error: invalid use of incomplete type 'class A'
..\main.cpp:82:7: error: forward declaration of 'class A'

I used the newest Eclipse (Windows 32 Bit) release from the eclipse.org download site:

Eclipse IDE for C/C++ Developers
Version: Indigo Release
Build id: 20110615-0604

Eclipse C/C++ Development Tools
Version: 8.0.0.201106081058
Build id: 201106081058

Windows 7 Professional (64 bit) Service Pack 1
Processor: AMD Athlon(tm) 64 X2 Dual Core Processor 4000+  2.10 GHz
Installed memory (RAM): 2,00 GB

The .log is attached for details.

java full version "1.7.0-b147"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
Comment 1 CDT Genie CLA 2011-09-15 06:23:01 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 357256: Recursive inheritance causes a StackOverflowError.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=8bc2b5635849a3c876a436eb794ac06170ccc9d3
Comment 2 Markus Schorn CLA 2011-09-19 08:19:20 EDT
Added testcase and fix.
Comment 3 CDT Genie CLA 2011-09-19 08:23:08 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 357256: Recursive inheritance causes a StackOverflowError.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=38c0bca1206e09c4f414ca3bb0aaee8733bb8dbf
Comment 4 Markus Schorn CLA 2011-10-31 10:19:19 EDT
*** Bug 362402 has been marked as a duplicate of this bug. ***