http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46133
Summary: constexpr needed for C99 complex type creation from
ctor with two floating point types
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Small reproducer:
struct complex
{
typedef float value_type;
typedef __complex__ float _ComplexT;
constexpr complex(_ComplexT __z) : _M_value(__z) { }
constexpr complex(float __r = 0.0f, float __i = 0.0f)
: _M_value(__r + __i * 1.0fi) { }
private:
_ComplexT _M_value;
};
constexpr complex c1;
Gives:
%$bin/H-x86_64-gcc-constexpr.20101022/bin/g++ -c -std=gnu++0x complex_wanna.cc
complex_wanna.cc:16:19: error: ‘(__complex__ float){0.0f, 0.0f}’ is not a
constant expression
complex_wanna.cc:16:19: error: in expansion of ‘complex(0.0f, 0.0f)’