public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105882] New: A possible constexpr bug
@ 2022-06-08  7:10 zhonghao at pku dot org.cn
  2022-06-08  7:16 ` [Bug c++/105882] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: zhonghao at pku dot org.cn @ 2022-06-08  7:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105882
           Summary: A possible constexpr bug
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code sample is as follows:

#include <complex>

struct real128
{
    __float128 m_value;

    template <typename T>
    constexpr bool get(T &rop) const
    {
        using value_type = typename T::value_type;

        rop.real(static_cast<value_type>(m_value));
        rop.imag(static_cast<value_type>(0));

        return true;
    }
};

constexpr auto fappo(real128 x)
{
    std::complex<double> ret{1,2};
    x.get(ret);
    return ret;
}

constexpr auto flap = fappo(real128{4});

gcc rejects this code, but clang accepts it. mp++ is a library for
multiprecision arithmetic. Its programmers disable several code lines, when gcc
compiles this project. Please check:
https://github.com/bluescarni/mppp/commit/628651b9928e35dc09c0c2de3d2561abababb55f

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/105882] A possible constexpr bug
  2022-06-08  7:10 [Bug c++/105882] New: A possible constexpr bug zhonghao at pku dot org.cn
@ 2022-06-08  7:16 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-08  7:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 88174.

*** This bug has been marked as a duplicate of bug 88174 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-08  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08  7:10 [Bug c++/105882] New: A possible constexpr bug zhonghao at pku dot org.cn
2022-06-08  7:16 ` [Bug c++/105882] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).