pioneer/src/win32/msvc_bug.cpp

67 lines
907 B
C++
Raw Permalink Normal View History

2020-12-31 07:32:16 -08:00
// Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details
2012-09-15 17:59:15 -07:00
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
2012-09-12 04:38:30 -07:00
2011-03-09 21:10:08 -08:00
#include <stdio.h>
#include <vector>
class V {
public:
double x, y, z;
2011-03-09 21:10:08 -08:00
V(){};
V(double _x, double _y, double _z) :
x(_x),
y(_y),
z(_z) {}
V(const V &v) :
x(v.x),
y(v.y),
z(v.z) {}
2011-03-09 21:10:08 -08:00
V operator+(const V a) const { return V(a.x + x, a.y + y, a.z + z); }
friend V operator*(const V a, const double s) { return V(a.x * s, a.y * s, a.z * s); }
2011-03-09 21:10:08 -08:00
};
struct M {
virtual void z(int *m) const {}
};
struct S : public M {
2011-03-09 21:10:08 -08:00
void bug();
};
struct C {
C(const S *s);
std::vector<int> v;
};
volatile void *g_q;
void S::bug()
{
2011-03-09 21:10:08 -08:00
g_q = this;
new C(this);
if (this != g_q) {
printf(":-(\n");
} else {
printf("zzz\n");
}
}
C::C(const S *s)
{
2011-03-09 21:10:08 -08:00
int m;
s->z(&m);
V mx;
mx * 5 + mx * 6;
2011-03-09 21:10:08 -08:00
}
/*
int main() {
S *s = new S();
s->bug();
return 0;
}
*/