Bug 91792 - [9 Regression] constexpr ++ or -- evaluation fails on float or double
Summary: [9 Regression] constexpr ++ or -- evaluation fails on float or double
Status: RESOLVED DUPLICATE of bug 91705
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-17 08:05 UTC by Cyp
Modified: 2019-09-17 08:11 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cyp 2019-09-17 08:05:35 UTC
According to https://godbolt.org/z/XzT1wz, compiles in 8.3 and trunk. Fails compilation on 9.2.

constexpr float f() { float x = 42; ++x; return x; }
void g() { constexpr float x = f(); }

<source>: In function 'void g()':
<source>:2:33:   in 'constexpr' expansion of 'f()'
<source>:2:34: error: '((float)1 + 4.2e+1f)' is not a constant expression
    2 | void g() { constexpr float x = f(); }
      |                                  ^
Comment 1 Andrew Pinski 2019-09-17 08:11:30 UTC
Fixed around a week ago:
91705

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