Bug 52881 - segmentation fault with nested class as parameter to constructor with default value
Summary: segmentation fault with nested class as parameter to constructor with default...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-08-30 14:08 UTC by scott dallamura
Modified: 2007-04-18 16:36 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-12-15 17:42:40 UTC
Embargoed:


Attachments (Terms of Use)

Description scott dallamura 2001-08-30 14:08:01 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; COM+ 
1.0.2204)

Description of problem:
sorry the summary is so big ;)
when i try to use a nested class as an argument to a constructor for the 
enclosing class, g++ gives a segmentation fault.  if i move the nested 
class outside of the enclosing class, or if i don't use the " = 
ServiceInformation()", or even if i use " = ServiceInformation(0)" it 
works fine.

I guess it's not a huge problem, since it's really easy to work around, 
but i got really scared when gcc segfaulted.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. make the following file "testes.h":
class testes {
public:
	struct ServiceInformation {
		ServiceInformation(long lPID = 0)
			:PID(lPID) {};
		long PID;
	};
	testes(const ServiceInformation &svcinf = ServiceInformation());
};

2. make this file testes.cpp:
#include "testes.h"

testes::testes(const ServiceInformation &svcinf) {
}

testes::~testes() {
}

3. compile the program:
g++ -c testes.cpp
	

Actual Results:  [sdallamura@vader testes]$ g++ testes.cpp
In file included from testes.cpp:1:
testes.h:9: Internal error: Segmentation fault.
Please submit a full bug report.


Expected Results:  it should have worked >:O

Additional info:


Note You need to log in before you can comment on or make changes to this bug.