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
#include <cassert>
#include <random>
int main() {
typedef std::lognormal_distribution<> D;
typedef D::param_type P;
typedef std::mt19937 G;
G g;
D d;
const P p1 = d.param();
const P p2 = d.param();
assert(p1 == p2);
double r1 = d(g, p1); // This line must not modify p1.
assert(p1 == p2);
}
libc++ fails the final assert, because D::param_type secretly contains a whole normal_distribution object(!) and then d(g, p1) secretly contains a const_cast so it can call that normal_distribution's operator().
The text was updated successfully, but these errors were encountered:
We haven't shipped this change on IBM's Open XL C++ compiler yet so I haven't been able to assess whether or not any customers will need to define _LIBCPP_ABI_OLD_LOGNORMAL_DISTRIBUTION.
As a courtesy I would appreciate it if we can add a deprecation warning (when _LIBCPP_ABI_OLD_LOGNORMAL_DISTRIBUTION is defined) in LLVM 15 with intention to remove it in LLVM 16.
libc++ fails the final
assert
, becauseD::param_type
secretly contains a wholenormal_distribution
object(!) and thend(g, p1)
secretly contains aconst_cast
so it can call thatnormal_distribution
'soperator()
.The text was updated successfully, but these errors were encountered: