internal compiler error with std::array designated initialization
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc |
New
|
Medium
|
|||
gcc-4.8 (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Trusty |
Fix Released
|
Undecided
|
Unassigned | ||
gcc-4.9 (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Trusty |
Invalid
|
Undecided
|
Unassigned | ||
gccgo-4.9 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Trusty |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The following code fails to compile with g++-4.8:
#include <array>
const int i = 0;
std::array<int, 1> bar = {
[i] = 0
};
I have since learned that designated initialization is not supported in (GNU) C++. In that case I would have expected a syntax error.
This is the compilation command and its output:
$ g++-4.8 -Wall -std=gnu++11 main.cpp
main.cpp:5:1: internal compiler error: in lookup_field_1, at cp/search.c:384
};
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:/
Preprocessed source stored into /tmp/ccUsV9BC.out file, please attach this to your bugreport.
The preprocessed source file is attached. g++-4.8 --version reports g++-4.8 (Ubuntu 4.8.1-2ubuntu1~
$ lsb_release -rd
Description: Ubuntu 12.04.4 LTS
Release: 12.04
$ apt-cache policy g++-4.8
g++-4.8:
Installed: 4.8.1-2ubuntu1~
Candidate: 4.8.1-2ubuntu1~
Version table:
*** 4.8.1-2ubuntu1~
500 http://
100 /var/lib/
CVE References
Changed in gcc-4.8 (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Triaged |
importance: | Medium → Low |
Changed in gcc-4.9 (Ubuntu): | |
importance: | Undecided → Low |
status: | New → Triaged |
Changed in gcc: | |
importance: | Unknown → Medium |
status: | Unknown → New |
Changed in gcc-4.9 (Ubuntu Trusty): | |
status: | New → Invalid |
Changed in gccgo-4.9 (Ubuntu): | |
status: | New → Invalid |
4.7 rejects this without an ICE, the ICE is seen on 4.8, 4.9 branches and trunk.
$ cat tst.cc
#include <array>
const int i = 0;
std::array<int, 1> bar = {
[i] = 0
};
$ g++-4.7 -Wall -std=gnu++0x tst.cc
tst.cc:5:3: error: 'std::array<int, 1ul>' has no non-static data member named 'i'
$ g++-4.8 -Wall -std=gnu++0x tst.cc
tst.cc:5:3: internal compiler error: in lookup_field_1, at cp/search.c:384
};
^
Please submit a full bug report,
with preprocessed source if appropriate.