diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-10-30 09:35:42 +0000 |
---|---|---|
committer | <> | 2015-01-09 11:51:27 +0000 |
commit | c27a97d04853380f1e80525391b3f0d156ed4c84 (patch) | |
tree | 68ffaade7c605bc80cffa18360799c98a810976f /gcc/testsuite/g++.dg/pr55106.C | |
parent | 6af3fdec2262dd94954acc5e426ef71cbd4521d3 (diff) | |
download | gcc-tarball-c27a97d04853380f1e80525391b3f0d156ed4c84.tar.gz |
Imported from /home/lorry/working-area/delta_gcc-tarball/gcc-4.9.2.tar.bz2.gcc-4.9.2
Diffstat (limited to 'gcc/testsuite/g++.dg/pr55106.C')
-rw-r--r-- | gcc/testsuite/g++.dg/pr55106.C | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/pr55106.C b/gcc/testsuite/g++.dg/pr55106.C new file mode 100644 index 0000000000..4727822f0d --- /dev/null +++ b/gcc/testsuite/g++.dg/pr55106.C @@ -0,0 +1,67 @@ +/* { dg-do compile } */ +/* { dg-options "-c -O3" } */ +template<typename _Tp> struct A { + typedef _Tp *pointer; + typedef _Tp& reference; + typedef _Tp& const_reference; + template<typename>struct rebind + { + typedef A other; + }; +}; + +template<typename _Alloc>struct __alloc_traits +{ + typedef typename _Alloc::pointer pointer; + typedef typename _Alloc::reference reference; + typedef typename _Alloc::const_reference const_reference; + template<typename _Tp>struct rebind + { + typedef typename _Alloc::template rebind<_Tp>::other other; + }; +}; +template<typename _Tp, typename _Alloc>struct B +{ + typedef typename __alloc_traits<_Alloc>::template rebind< + _Tp>::other _Tp_alloc_type; + typedef typename __alloc_traits<_Tp_alloc_type>::pointer pointer; + struct F + { + pointer _M_start; + }; + F _M_impl; +}; +template<typename _Tp, typename _Alloc = A<_Tp> >class vec : B<_Tp, _Alloc>{ + typedef B<_Tp, _Alloc> _Base; + typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef __alloc_traits<_Tp_alloc_type> _Alloc_traits; + +public: + typedef _Tp value_type; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + reference operator[](int p1) + { + return *(this->_M_impl._M_start + p1); + } + + const_reference operator[](long) const; +}; + +int a[17]; +class C { + vec<int> m_value; + void opModDivGuts(const C&); + int mostSetBitP1() const; +}; +void C::opModDivGuts(const C& p1) +{ + int b = p1.mostSetBitP1(), c = b + 1; + int d[16]; + + for (int i = c; i; i--) + a[i] = p1.m_value[i] << b; + + for (int i = 0; i < c; i++) + m_value[i] = d[i] >> b << -b; +} |