From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/g++.dg/opt/new1.C | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/new1.C (limited to 'gcc/testsuite/g++.dg/opt/new1.C') 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 class Buffer { + public: + inline void reserve(int num); + inline void resize(int s); + T *m_data; + int m_capacity; + int m_size; + }; +} +template void QScript::Buffer::resize(int s) { + if (m_capacity < s) + reserve (s << 1); +} +template void QScript::Buffer::reserve(int x) { + T *new_data = new T[m_capacity]; + for (int i=0; i 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()); + } + } +} -- cgit v1.2.3