This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54431] [C++11] g++ crashes when compiling the following file
- From: "icegood1980 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 31 Oct 2012 22:26:46 +0000
- Subject: [Bug c++/54431] [C++11] g++ crashes when compiling the following file
- Auto-submitted: auto-generated
- References: <bug-54431-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54431
--- Comment #4 from icegood1980 at gmail dot com <icegood1980 at gmail dot com> 2012-10-31 22:26:46 UTC ---
(In reply to comment #1)
> Gcc also doesn't crash if the lambda line is changed to
>
> [this]{this->bar();}();
>
> Although the resulting program does.
Of course, resulting program should crash because you have infinite reccursion
call. Anyway next code crashes too:
#include <iostream>
template <class>
struct foo
{
public:
void blah()
{
std::cerr<<"blah-blah"<<std::endl;
}
void bar()
{
[this]{blah();}();
}
};
int main()
{
foo<int> ss;
ss.bar();
}
For workaround with [this] thanks, i should guess...