You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see in GCC's intermediate output (obtained by disabling constexpr via macros), ~B is always called before ~A. Nevertheless, clang prints
source>:44:12: error: call to consteval function 'f' is not a constant expression
return f();
^
<source>:13:43: note: read of object outside its lifetime is not allowed in a constant expression
CONSTEXPR A(const A& other) { m_val = other.m_val;}
^
<source>:28:37: note: in call to 'A(A())'
CONSTEXPR A finished() { return m_a; }
^
<source>:27:22: note: in call to '&A() << 1->finished()'
CONSTEXPR ~B() { finished(); }
^
<source>:38:10: note: in call to '&A() << 1->~B()'
A a{(A() << 1, 2, 3, 4).finished()};
^
<source>:44:12: note: in call to 'f()'
return f();
^
(I think clang is wrong here, but of course gcc may be getting the destruction order wrong.)
The text was updated successfully, but these errors were encountered:
Consider this (derived from the Eigen library, tested with clang 13.0.0 and clang 12)
Godbolt link here: https://godbolt.org/z/njfxf9jP5
As you can see in GCC's intermediate output (obtained by disabling
constexpr
via macros), ~B is always called before ~A. Nevertheless, clang prints(I think clang is wrong here, but of course gcc may be getting the destruction order wrong.)
The text was updated successfully, but these errors were encountered: