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/torture/pr44972.C | 142 +++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr44972.C (limited to 'gcc/testsuite/g++.dg/torture/pr44972.C') diff --git a/gcc/testsuite/g++.dg/torture/pr44972.C b/gcc/testsuite/g++.dg/torture/pr44972.C new file mode 100644 index 000000000..e409148da --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr44972.C @@ -0,0 +1,142 @@ +/* { dg-do compile } */ + +#include +#include +#include + +namespace boost { + +template +class optional; + +class aligned_storage +{ + char data[ 1000 ]; + public: + void const* address() const { return &data[0]; } + void * address() { return &data[0]; } +} ; + + +template +class optional_base +{ + protected : + optional_base(){} + optional_base ( T const& val ) + { + construct(val); + } + + template + void assign ( optional const& rhs ) + { + if (!is_initialized()) + if ( rhs.is_initialized() ) + construct(T()); + } + + public : + + bool is_initialized() const { return m_initialized ; } + + protected : + + void construct ( T const& val ) + { + new (m_storage.address()) T(val) ; + } + + T const* get_ptr_impl() const + { return static_cast(m_storage.address()); } + + private : + + bool m_initialized ; + aligned_storage m_storage ; +} ; + + +template +class optional : public optional_base +{ + typedef optional_base base ; + + public : + + optional() : base() {} + optional ( T const& val ) : base(val) {} + optional& operator= ( optional const& rhs ) + { + this->assign( rhs ) ; + return *this ; + } + + T const& get() const ; + + T const* operator->() const { assert(this->is_initialized()) ; return this->get_ptr_impl() ; } + +} ; + + +} // namespace boost + + +namespace std +{ + + template + struct array + { + typedef _Tp value_type; + typedef const value_type* const_iterator; + + value_type _M_instance[_Nm]; + + }; +} + + +class NT +{ + double _inf, _sup; +}; + + +template < typename T > inline +std::array +make_array(const T& b1) +{ + std::array a = { { b1 } }; + return a; +} + +class V +{ + typedef std::array Base; + Base base; + +public: + V() {} + V(const NT &x) + : base(make_array(x)) {} + +}; + +using boost::optional ; + +optional< std::pair< NT, NT > > + linsolve_pointC2() ; + +optional< V > construct_normal_offset_lines_isecC2 ( ) +{ + optional< std::pair > ip; + + ip = linsolve_pointC2(); + + V a(ip->first) ; + return a; +} + + + -- cgit v1.2.3