https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61791

            Bug ID: 61791
           Summary: [C++11] [constexpr] Additional overloads of std::real
                    should be a constexpr function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kariya_mitsuru at hotmail dot com

I think that the sample code below should be compiled successfully.

===========================================
#include <complex>

static constexpr double d = std::real(10);

int main() {}
===========================================

Note that it is compiled successfully if the argument is
std::complex<double>(10) instead of 10.

According to C++11 standard 26.4.9[cmplx.over] paragraph 2, "if either argument
has type complex<double>, double, or an integer type, then both arguments are
effectively cast to complex<double>."

Therefore, I think it should be compiled successfully too.

Reply via email to