http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57941
Bug ID: 57941
Summary: [c++11] confusing error message with invalid constexpr
constructor in template struct
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
% cat test.cpp
template <typename T> struct a
{
int i;
constexpr a (): i (b ()) { }
constexpr int b () { return c (); }
int c () const { throw 42; }
constexpr operator bool () { return true; }
};
static_assert (a <int> (), "foo");
%g++-4.7 -std=c++11 test.cpp
test.cpp:10:1: error: non-constant condition for static assertion
test.cpp:10:1: error: 'constexpr a<T>::a() [with T = int]' called in a constant
expression
test.cpp:4:13: note: 'constexpr a<T>::a() [with T = int]' is not usable as a
constexpr function because:
%
Because what?
This message is particularly confusing if other unrelated messages appear
afterwards, as it wrongly claims those to be the reason for this one.
(I understand that the program is wrong, it's just about the message.)