[Bug c++/64462] New: ICE while compiling lambda using local constexpr reference variable

2014-12-31 Thread lunow at math dot hu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64462

Bug ID: 64462
   Summary: ICE while compiling lambda using local constexpr
reference variable
   Product: gcc
   Version: 4.9.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: lunow at math dot hu-berlin.de

The following Code triggers the crash (C++11 mode)

int x = 0;
int z;

int main() {
  constexpr int y = x;
  [=] { z = y; }();
}

$ g++ gccbug.cpp -std=c++11
gccbug.cpp: In lambda function:
gccbug.cpp:7:11: internal compiler error: in cp_build_modify_expr, at
cp/typeck.c:7446
   [=] { z = y; }();
   ^
Please submit a full bug report,
...


[Bug c++/53783] New: [4.8 Regression] lambda in lambda in template function rejected

2012-06-26 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53783

 Bug #: 53783
   Summary: [4.8 Regression] lambda in lambda in template function
rejected
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lu...@math.hu-berlin.de


The following valid program is rejected (using latest version from trunk)

template class void foo() { [] { [] {}; }; }
int main() { foovoid(); }

daniel@daniel-VirtualBox:~/projects/Code/gcctest$ /opt/gcc/trunk/bin/g++
-std=c++11 test.cpp 
test.cpp: In instantiation of ‘foo() [with template-parameter-1-1 =
void]::lambda()’:
test.cpp:1:32:   required from ‘struct foo() [with template-parameter-1-1 =
void]::lambda()’
test.cpp:1:31:   required from ‘void foo() [with template-parameter-1-1 =
void]’
test.cpp:2:24:   required from here
test.cpp:1:36: error: use of ‘foo() [with template-parameter-1-1 =
void]::lambda()’ before deduction of ‘auto’
 template class void foo() { [] { [] {}; }; }
^
test.cpp: In instantiation of ‘struct foo() [with template-parameter-1-1 =
void]::lambda()::lambda()’:
test.cpp:1:36:   required from ‘foo() [with template-parameter-1-1 =
void]::lambda()’
test.cpp:1:32:   required from ‘struct foo() [with template-parameter-1-1 =
void]::lambda()’
test.cpp:1:31:   required from ‘void foo() [with template-parameter-1-1 =
void]’
test.cpp:2:24:   required from here
test.cpp:1:37: error: use of ‘foo() [with template-parameter-1-1 =
void]::lambda()::lambda()’ before deduction of ‘auto’
 template class void foo() { [] { [] {}; }; }
 ^
test.cpp:1:37: error: invalid use of ‘auto’
test.cpp:1:37: error: inconsistent deduction for ‘auto’: ‘auto’ and then ‘void’


[Bug c++/53488] Incorrect code generated when capturing a constant by reference in a lambda

2012-06-24 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53488

--- Comment #4 from Daniel Lunow lunow at math dot hu-berlin.de 2012-06-24 
14:21:31 UTC ---
Created attachment 27693
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27693
small test case

Just wanted to report the same bug with gcc 4.7.1. 
I found out, that it occurs, if the initializer depends on some template
argument.

C:\dev\projects\compiler testg++ -std=c++11 gcc_test5.cpp -Wall -o
gcc_test5.exe
gcc_test5.cpp: In lambda function:
gcc_test5.cpp:10:29: warning: 'i' is used uninitialized in this function
[-Wuninitialized]

C:\dev\projects\compiler testgcc_test5.exe
0
which should have given 4.


[Bug c++/53488] Incorrect code generated when capturing a constant by reference in a lambda

2012-06-24 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53488

--- Comment #5 from Daniel Lunow lunow at math dot hu-berlin.de 2012-06-24 
14:30:19 UTC ---
Created attachment 27694
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27694
integral constant-expression not an integral constant-expression

This test case should compile, but it does not. Its not the same as the
constant not beeing captured, but I can imagine it is very close problem.

C:\dev\projects\compiler testg++ -std=c++11 gcc_test6.cpp
gcc_test6.cpp: In instantiation of 'foo() [with T = void]::lambda()':
gcc_test6.cpp:8:4:   required from 'struct foo() [with T = void]::lambda()'
gcc_test6.cpp:8:3:   required from 'void foo() [with T = void]'
gcc_test6.cpp:13:13:   required from here
gcc_test6.cpp:8:15: error: size of array is not an integral constant-expression


[Bug c++/53488] Incorrect code generated when capturing a constant by reference in a lambda

2012-06-24 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53488

Daniel Lunow lunow at math dot hu-berlin.de changed:

   What|Removed |Added

 CC||lunow at math dot
   ||hu-berlin.de

--- Comment #8 from Daniel Lunow lunow at math dot hu-berlin.de 2012-06-25 
00:32:00 UTC ---
Then you must have missed the example in 5.1.2 [expr.prim.lambda] p. 12.
[Example:
void f1(int i) {
  int const N = 20;
  auto m1 = [=]{
int const M = 30;
auto m2 = [i]{
  int x[N][M]; // OK: N and M are not odr-used
  // ...
};
  };
  // ...
}
- end example]
Sure its non-normative, but this is what has always worked through a
combination of
8.3.4 [dcl.array], 3.4.1p1,6 [basic.lookup.unqual], 3.3.1p1
[basic.scope.declarative], 3.3.3p1,3 [basic.scope.local] and 5.19p2
[expr.const].

By the way the bug is independent of capturing by value/reference and in my
second example nothing is captured at all. It is not necessary to capture,
because i is not odr-used (5.1.2p11, 3.2p2).

I just put it here because, it occurs under the same circumstances 
 * constant integral local variable
 * initialized by an expression dependent on a template parameter, but not if
the initializer is the name of a non-template type parameter
 * used (but not odr-used) inside lambda.
and of course gcc has no problems with both examples, if i's initialization
does not depend on a template parameter.


[Bug c++/53741] New: ICE on lambda calling static template member function with explicit template argument specification

2012-06-21 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53741

 Bug #: 53741
   Summary: ICE on lambda calling static template member function
with explicit template argument specification
Classification: Unclassified
   Product: gcc
   Version: 4.6.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lu...@math.hu-berlin.de


Created attachment 27675
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27675
testcase

Attached is a testcase ICEing on 4.6.3 and 4.7.1.
This bug is related to bug 52183 and bug 51494.

GCC 4.6.3 Output:
C:\dev\projects\compiler testgcc -std=c++0x gcc_test4.cpp
gcc_test4.cpp: In lambda function:
gcc_test4.cpp:8:7:   instantiated from 'X::foo(T) [with T = int]::lambda()'
gcc_test4.cpp:8:5:   instantiated from 'void X::foo(T) [with T = int]'
gcc_test4.cpp:15:10:   instantiated from here
gcc_test4.cpp:8:11: internal compiler error: in push_class_level_binding, at
cp/name-lookup.c:2833
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

GCC 4.7.1 Output:
C:\dev\projects\compiler testgcc -std=c++0x gcc_test4.cpp
gcc_test4.cpp: In instantiation of 'X::foo(T) [with T = int]::lambda()':
gcc_test4.cpp:8:7:   required from 'struct X::foo(T) [with T =
int]::lambda()'
gcc_test4.cpp:8:5:   required from 'void X::foo(T) [with T = int]'
gcc_test4.cpp:15:10:   required from here
gcc_test4.cpp:8:11: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.


[Bug c++/53624] New: GCC rejects function local types in template function with default template arguments

2012-06-09 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53624

 Bug #: 53624
   Summary: GCC rejects function local types in template function
with default template arguments
Classification: Unclassified
   Product: gcc
   Version: 4.6.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lu...@math.hu-berlin.de


Created attachment 27595
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27595
testcase

The error occurs when there is at one template argument with default and one
without. Errors are generated for local structs, classes, unions and lambda
functions.
For the attached usecase I get with gcc 4.6.3 and 4.7.0:
C:\dev\projects\compiler testg++ gcc_test2.cpp --std=c++0x -fsyntax-only
gcc_test2.cpp: In function 'void Foo(T)':
gcc_test2.cpp:5:12: error: no default argument for 'T'


[Bug c++/53624] GCC rejects function local types in template function with default template arguments

2012-06-09 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53624

--- Comment #2 from Daniel Lunow lunow at math dot hu-berlin.de 2012-06-10 
04:49:29 UTC ---
Their is no requirement (in the c++11 standard) for function templates that
implies subsequent template parameters after a template parameter with default
template argument must also have default template arguments (in contrast to
class templates). In general this works in gcc.
But with the local types inside the template function gcc might reject it
because it creates local types as templated with the same template
parameters/default arguments and checks the requirement for class templates.

The line number/offset in the error message clearly refers to the local struct.


[Bug c++/53567] New: ICE: Error reporting routines re-entered on missing enum entry

2012-06-03 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53567

 Bug #: 53567
   Summary: ICE: Error reporting routines re-entered on missing
enum entry
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lu...@math.hu-berlin.de


C:\dev\projects\chessgcc --std=c++11 gcc_test.cpp
'
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

I attached a minimal testcase.

I would expect something like:
C:\dev\projects\chessgcc --std=c++11 gcc_test.cpp
gcc_test.cpp: In instantiation of 'EnumMaskEnumT operator~(EnumT) [with EnumT
= A; typename IntegerTypesizeof (EnumT), ((EnumT)((-1))  (EnumT)(0))::type =
unsigne
d int]':
gcc_test.cpp:26:7:   required from here
gcc_test.cpp:21:57: error: 'maskAll' is not a member of 'A'


[Bug c++/53567] ICE: Error reporting routines re-entered on missing enum entry

2012-06-03 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53567

--- Comment #1 from Daniel Lunow lunow at math dot hu-berlin.de 2012-06-03 
19:53:00 UTC ---
Created attachment 27548
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27548
testcase


[Bug c++/53567] ICE: Error reporting routines re-entered on missing enum entry

2012-06-03 Thread lunow at math dot hu-berlin.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53567

--- Comment #2 from Daniel Lunow lunow at math dot hu-berlin.de 2012-06-03 
19:55:11 UTC ---
Created attachment 27549
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27549
the real testcase

I accidently uploaded the wrong file, this is the correct file.