http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53839
Bug #: 53839 Summary: [4.7/4.8 Regresion] [C++11] internal compiler error: in adjust_temp_type, at cp/semantics.c:6391 Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@gcc.gnu.org #include <chrono> namespace c = std::chrono; struct X { long x; }; X f(const c::time_point<c::system_clock, c::microseconds>& tp) { return { (tp - tp).count() }; } void g() { c::time_point<c::system_clock, c::microseconds> tp; f(tp); } ICE with 4.7.1 and 4.8-20120701 snapshot, the snapshot output is ice.cc: In function 'X f(const std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<long int, std::ratio<1l, 1000000l> > >&)': ice.cc:9:20: in constexpr expansion of 'std::chrono::operator-<std::chrono::system_clock, std::chrono::duration<long int, std::ratio<1l, 1000000l> >, std::chrono::duration<long int, std::ratio<1l, 1000000l> > >((* & tp), (* & tp))' /home/jwakely/gcc/4.x/include/c++/4.8.0/chrono:629:41: in constexpr expansion of '(& __lhs)->std::chrono::time_point<_Clock, _Dur>::time_since_epoch<std::chrono::system_clock, std::chrono::duration<long int, std::ratio<1l, 1000000l> > >()' ice.cc:9:32: internal compiler error: in adjust_temp_type, at cp/semantics.c:6396 return { (tp - tp).count() }; ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Compiles OK with 4.6.3 or if the expression is changed to not use a temporary: auto x = tp - tp; return { x.count() };