[Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Tue Oct 2 08:22:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54777
Bug #: 54777
Summary: [C++11] Comma operator in constexpr environment can
cause ICE
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
Using gcc 4.8.0 20120923 (experimental) and compiler flags
-Wall -pedantic -std=c++11
the following code gives an ICE:
//-------------
struct array {
int data[1];
constexpr const int& at(unsigned i)
{
return (i < 1 ? 0 : throw 1), data[i];
//return i < 1 ? data[i] : (throw 0, data[i]); // OK
}
};
int main() {
constexpr array a{};
constexpr int i = a.at(0);
}
//-------------
"
main.cpp||In function 'int main()':|
main.cpp|12| in constexpr expansion of 'a.array::at(0u)'|
main.cpp|12|internal compiler error: in adjust_temp_type, at
cp/semantics.c:6425|
"
The code should be accepted.
More information about the Gcc-bugs
mailing list