This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71092] [6/7 Regression] ICE: in cxx_eval_call_expression, at cp/constexpr.c:1449; only with -Os
- From: "trippels at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 16 May 2016 06:50:25 +0000
- Subject: [Bug c++/71092] [6/7 Regression] ICE: in cxx_eval_call_expression, at cp/constexpr.c:1449; only with -Os
- Auto-submitted: auto-generated
- References: <bug-71092-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71092
--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to schoko.teddy from comment #3)
> Created attachment 38494 [details]
> Preprocessed source
>
> This Error occurs while compiling this motioncontrollayer.cpp file from a Qt
> project. Gzipped because of largeness.
Looks like a ICE on invalid and is probably unrelated to the original issue:
markus@x4 tmp % cat motioncontrollayer.ii
namespace std {
template <typename _Tp> struct A { static constexpr _Tp value = 0; };
typedef A<bool> false_type;
struct B : false_type {};
template <typename> struct is_floating_point : B {};
template <int, typename> struct enable_if { typedef int type; };
}
typedef int Value;
namespace detail {
template <typename T, std::enable_if<std::is_floating_point<Value>::value,
bool>::type = false>
constexpr Value toValue(T) {}
}
struct Quantity {
template <typename T> constexpr Quantity(T) : value(detail::toValue(0)) {}
Value value;
};
struct Pose {
int x;
int y;
Quantity phi;
constexpr Pose() : x(), y(), phi(0) {}
};
struct C {
Pose pose;
};
struct D {
Pose route[1];
};
void fn1() { C obj; }
void fn2() { D obj; }
markus@x4 tmp % clang++ -std=c++14 -ferror-limit=1 -c motioncontrollayer.ii
motioncontrollayer.ii:12:17: error: no return statement in constexpr function
constexpr Value toValue(T) {}
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
markus@x4 tmp % icpc -std=c++14 -c motioncontrollayer.ii
motioncontrollayer.ii(12): error: missing return statement at end of non-void
function "detail::toValue(T)"
constexpr Value toValue(T) {}
^
detected during instantiation of "Quantity::Quantity(T) [with T=int]"
at line 22
compilation aborted for motioncontrollayer.ii (code 2)
markus@x4 tmp % g++ -c motioncontrollayer.ii
motioncontrollayer.ii: In constructor âconstexpr D::D()â:
motioncontrollayer.ii:27:8: in constexpr expansion of âPose()â
motioncontrollayer.ii:22:37: in constexpr expansion of
â((Pose*)this)->Pose::phi.Quantity::Quantity<int>(0)â
motioncontrollayer.ii:15:70: in constexpr expansion of âdetail::toValue<int,
0>(0)â
motioncontrollayer.ii:27:8: internal compiler error: in
cxx_eval_call_expression, at cp/constexpr.c:1449