summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/new1.C
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/opt/new1.C
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/new1.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/new1.C71
1 files changed, 71 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/new1.C b/gcc/testsuite/g++.dg/opt/new1.C
new file mode 100644
index 000000000..dbcc0f851
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/new1.C
@@ -0,0 +1,71 @@
+// PR c++/39367
+// { dg-options "-O" }
+
+class QScriptEnginePrivate;
+class QScriptClassInfo;
+namespace QScript {
+ enum Type { InvalidType };
+};
+class QScriptValueImpl {
+public:
+ inline QScriptValueImpl();
+ QScript::Type m_type;
+};
+namespace QScript {
+ namespace Ecma {
+ class Core {
+ public:
+ inline QScriptEnginePrivate *engine() const { }
+ inline QScriptClassInfo *classInfo() const { }
+ QScriptValueImpl publicPrototype;
+ };
+ class Boolean: public Core {
+ void newBoolean(QScriptValueImpl *result, bool value = false);
+ };
+ }
+ template <typename T> class Buffer {
+ public:
+ inline void reserve(int num);
+ inline void resize(int s);
+ T *m_data;
+ int m_capacity;
+ int m_size;
+ };
+}
+template <typename T> void QScript::Buffer<T>::resize(int s) {
+ if (m_capacity < s)
+ reserve (s << 1);
+}
+template <typename T> void QScript::Buffer<T>::reserve(int x) {
+ T *new_data = new T[m_capacity];
+ for (int i=0; i<m_size; ++i)
+ new_data[i] = m_data[i];
+}
+class QScriptObject {
+public:
+ inline void reset();
+ QScript::Buffer<QScriptValueImpl> m_values;
+};
+class QScriptEnginePrivate {
+public:
+ inline QScriptObject *allocObject() { return 0; }
+ inline void newObject(QScriptValueImpl *o, const QScriptValueImpl &proto,
+ QScriptClassInfo *oc = 0);
+};
+inline void QScriptEnginePrivate::newObject(QScriptValueImpl *o,
+ const QScriptValueImpl &proto,
+ QScriptClassInfo *oc)
+{
+ QScriptObject *od = allocObject();
+ od->reset();
+}
+inline QScriptValueImpl::QScriptValueImpl() : m_type(QScript::InvalidType) { }
+inline void QScriptObject::reset() { m_values.resize(0); }
+namespace QScript {
+ namespace Ecma {
+ void Boolean::newBoolean(QScriptValueImpl *result, bool value)
+ {
+ engine()->newObject(result, publicPrototype, classInfo());
+ }
+ }
+}