Bug 51674 - No errors on non-existent symbol in constructor
Summary: No errors on non-existent symbol in constructor
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-24 14:00 UTC by So Townsend
Modified: 2011-12-24 14:14 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Example of problem (105 bytes, text/x-c++src)
2011-12-24 14:00 UTC, So Townsend
Details

Note You need to log in before you can comment on or make changes to this bug.
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"