public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/80039] `constexpr` member function calls in a `constexpr` constructor are ignored if the object is defined locally
       [not found] <bug-80039-4@http.gcc.gnu.org/bugzilla/>
@ 2021-03-30  5:49 ` david at doublewise dot net
  2021-04-08 10:20 ` jakub at gcc dot gnu.org
  2021-04-08 15:22 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: david at doublewise dot net @ 2021-03-30  5:49 UTC (permalink / raw)
  To: gcc-bugs

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

David Stone <david at doublewise dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david at doublewise dot net

--- Comment #1 from David Stone <david at doublewise dot net> ---
Here's another reproduction

```
struct s {
        int m_value = 0;

        constexpr int value() const {
                return m_value;
        }

        constexpr s()
        {
                value();
                m_value = 1;
        }
};

constexpr auto x = s();
static_assert(x.value() == 1);
```

Still a problem on trunk.

This example shows it's not just that side effects are ignored, but also that
the return value is cached. My guess is that there is some code path that
memoizes calls to constexpr functions, replacing them with their return value,
and that code is getting invoked when it shouldn't be.

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

* [Bug c++/80039] `constexpr` member function calls in a `constexpr` constructor are ignored if the object is defined locally
       [not found] <bug-80039-4@http.gcc.gnu.org/bugzilla/>
  2021-03-30  5:49 ` [Bug c++/80039] `constexpr` member function calls in a `constexpr` constructor are ignored if the object is defined locally david at doublewise dot net
@ 2021-04-08 10:20 ` jakub at gcc dot gnu.org
  2021-04-08 15:22 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-08 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
See PR99859

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

* [Bug c++/80039] `constexpr` member function calls in a `constexpr` constructor are ignored if the object is defined locally
       [not found] <bug-80039-4@http.gcc.gnu.org/bugzilla/>
  2021-03-30  5:49 ` [Bug c++/80039] `constexpr` member function calls in a `constexpr` constructor are ignored if the object is defined locally david at doublewise dot net
  2021-04-08 10:20 ` jakub at gcc dot gnu.org
@ 2021-04-08 15:22 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-08 15:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Handled in PR99859.

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

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

end of thread, other threads:[~2021-04-08 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-80039-4@http.gcc.gnu.org/bugzilla/>
2021-03-30  5:49 ` [Bug c++/80039] `constexpr` member function calls in a `constexpr` constructor are ignored if the object is defined locally david at doublewise dot net
2021-04-08 10:20 ` jakub at gcc dot gnu.org
2021-04-08 15:22 ` jakub 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).