http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51223
Bug #: 51223
Summary: [4.5/4.6/4.7 Regression] ICE with invalid function
parameter
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following invalid code snippet triggers an ICE since GCC 4.5.0:
==========================
struct A
{
A foo(void i = 0);
};
void bar()
{
A().foo();
}
A A::foo(void i)
{
return A();
}
==========================
bug.cc:3:18: error: 'i' has incomplete type
bug.cc:3:19: error: invalid use of 'void'
bug.cc: In function 'void bar()':
bug.cc:8:11: error: call to 'A A::foo(<type error>)' uses the default argument
for parameter 1, which is not yet defined
bug.cc: At global scope:
bug.cc:11:15: error: 'i' has incomplete type
bug.cc:11:16: error: invalid use of 'void'
bug.cc: In function 'void bar()':
bug.cc:8:11: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in useless_type_conversion_p, at tree-ssa.c:1460
Please submit a full bug report, [etc.]