Bug 51674

Summary: No errors on non-existent symbol in constructor
Product: gcc Reporter: So Townsend <so.townsend>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 4.6.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Attachments: Example of problem

Description So Townsend 2011-12-24 14:00:32 UTC
Created attachment 26183 [details]
Example of problem

Creating a class with a constructor that calls another construct with a non existent symbol yields a segfault and no compile time errors or warnings.

Both -std=C++0x and standard compilation have the same issue.
Comment 1 So Townsend 2011-12-24 14:02:34 UTC
Comment on attachment 26183 [details]
Example of problem

>#include <iostream>
>
>class Foo
>{
>public:
>	Foo()
>	{
>		Foo(a);
>	}
>
>	Foo(int x)
>	{
>	}
>};
>
>int main()
>{
>	Foo f;
>	return 0;
>}
Comment 2 Jonathan Wakely 2011-12-24 14:12:08 UTC
that doesn't call a constructor, it declares an object called a, so is identical to:

Foo()
{
  Foo a;
}

which causes an infinite recursion
Comment 3 Jonathan Wakely 2011-12-24 14:14:16 UTC
well, sorry, it does call a constructor, but it calls the same one (the default cosntructor) 

it doesn't call the other constructor "with a non-existent symbol"