[Bug c++/66635] New: g++ ICE when compiling constexpr code with comma operator
andreas at sandberg dot pp.se
gcc-bugzilla@gcc.gnu.org
Tue Jun 23 09:45:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66635
Bug ID: 66635
Summary: g++ ICE when compiling constexpr code with comma
operator
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: andreas at sandberg dot pp.se
Target Milestone: ---
Use of the comma operator in constexpr environment causes ICE in g++ 5.1.0. The
following test case triggers the bug:
--- Begin test case ---
#include <cassert>
struct Foo {
constexpr Foo(const unsigned i) : val(i) {}
constexpr Foo operator-(const Foo &rhs) const {
return assert(val >= rhs.val), Foo(val - rhs.val);
}
unsigned val;
};
constexpr Foo foo(Foo(1) - Foo(2));
--- End test case ---
I have been able to reproduce the bug on both Linux and MacOS for gcc version
5.1.0. A colleague tested this using trunk yesterday and the error still seems
to be present. g++ version 4.9.1 does not seem to suffer from this bug.
This seems to be closely related to bug 54777.
More information about the Gcc-bugs
mailing list