Bug 44366 - [C++0x] g++ crashes when declaring a lambda expression using a typedef'd decltype.
Summary: [C++0x] g++ crashes when declaring a lambda expression using a typedef'd decl...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.1
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-01 14:16 UTC by LindleyF
Modified: 2010-06-08 04:38 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2010-06-07 23:57:51


Attachments
g++ -std=c++0x -o test2 test2.cpp -g -save-temps -v &> gcclog.txt (784 bytes, text/plain)
2010-06-01 14:20 UTC, LindleyF
Details
Preprocessed file (32.57 KB, text/plain)
2010-06-01 14:20 UTC, LindleyF
Details
Small test case (317 bytes, text/plain)
2010-06-01 14:22 UTC, LindleyF
Details

Note You need to log in before you can comment on or make changes to this bug.
Description LindleyF 2010-06-01 14:16:58 UTC
In the minimal example (to be attached), g++ crashes with a "please submit bug report" message.

The goal of the original code was to provide a generic multi-label connected component algorithm. Therefore, I wished to output a label along with each Component of the same type as the input data 2d array----decltype(data[0][0]).

However, when I added a lambda expression as part of operating on something related to this type, g++ began crashing during compile.

I realize that in some cases decltype(data[0][0]) may have a reference type so this code may be invalid; however, the compiler still should not crash, but simply report an error.
Comment 1 LindleyF 2010-06-01 14:20:13 UTC
Created attachment 20796 [details]
g++ -std=c++0x -o test2 test2.cpp -g -save-temps -v &> gcclog.txt

Build log generated by
g++ -std=c++0x -o test2 test2.cpp -g -save-temps -v &> gcclog.txt
Comment 2 LindleyF 2010-06-01 14:20:59 UTC
Created attachment 20797 [details]
Preprocessed file

Preprocessor output for the small test case.
Comment 3 LindleyF 2010-06-01 14:22:34 UTC
Created attachment 20798 [details]
Small test case

Small test case file.
Comment 4 Paolo Carlini 2010-06-03 16:40:07 UTC
Let's CC Jason...
Comment 5 Jason Merrill 2010-06-08 00:07:49 UTC
This actually isn't lambda-specific.  The same crash happens with

template <typename T>
void f(T t, decltype(*t))
{
  struct A { void g() { foo; } };
}
Comment 6 Jason Merrill 2010-06-08 04:34:13 UTC
Subject: Bug 44366

Author: jason
Date: Tue Jun  8 04:33:50 2010
New Revision: 160420

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160420
Log:
	PR c++/44366
	* error.c (dump_parameters): Mask out TFF_SCOPE.
	(dump_simple_decl): Don't print the scope of a PARM_DECL.
	(dump_scope): Remove no-op mask.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype23.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/error.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 Jason Merrill 2010-06-08 04:34:41 UTC
Subject: Bug 44366

Author: jason
Date: Tue Jun  8 04:34:20 2010
New Revision: 160421

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160421
Log:
	PR c++/44366
	* error.c (dump_simple_decl): Don't print the scope of a
	PARM_DECL.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/cpp0x/decltype23.C
Modified:
    branches/gcc-4_5-branch/gcc/cp/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/error.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog

Comment 8 Jason Merrill 2010-06-08 04:37:56 UTC
Or even:

template <typename T>
void f(T t, int(*)[sizeof(t)])
{
  struct A { void g() {
    foo;                                            
  } };
}

which makes this a regression against 3.2.
Comment 9 Jason Merrill 2010-06-09 15:12:23 UTC
Subject: Bug 44366

Author: jason
Date: Wed Jun  9 15:11:42 2010
New Revision: 160483

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160483
Log:
	PR c++/44366
	* g++.dg/cpp0x/decltype23.C: Move to...
	* g++.dg/diagnostic/parm1.C: ...here, and remove decltype.

Added:
    trunk/gcc/testsuite/g++.dg/diagnostic/
    trunk/gcc/testsuite/g++.dg/diagnostic/parm1.C
      - copied, changed from r160478, trunk/gcc/testsuite/g++.dg/cpp0x/decltype23.C
Removed:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype23.C
Modified:
    trunk/gcc/testsuite/ChangeLog