From ee2ec6d2e2197bcd87b135f48ae82c209a83da9a Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Wed, 10 Oct 2012 01:40:27 +0159 Subject: Sync with svn rev. 192243 Signed-off-by: Bernhard Rosenkraenzer --- gcc/testsuite/g++.dg/torture/pr54735.C | 179 +++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr54735.C (limited to 'gcc/testsuite/g++.dg/torture/pr54735.C') diff --git a/gcc/testsuite/g++.dg/torture/pr54735.C b/gcc/testsuite/g++.dg/torture/pr54735.C new file mode 100644 index 000000000..0604ec517 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr54735.C @@ -0,0 +1,179 @@ +// { dg-do compile } + +class Gmpfr +{}; +class M : Gmpfr +{ +public: + Gmpfr infconst; + M(int); +}; +templatestruct A; +templateclass N; +templateclass O; +templatestruct B; +struct C +{ + enum + { value }; +}; +class D +{ +public: + enum + { ret }; +}; +struct F +{ + enum + { ret = 0 ? : 0 }; +}; +templatestruct G +{ + typedef Otype; +}; +struct H +{ + void operator * (); +}; +struct I +{ + enum + { RequireInitialization = C::value ? : 0, ReadCost }; +}; +templatestruct J +{ + enum + { ret = A::InnerStrideAtCompileTime }; +}; +templatestruct K +{ + enum + { ret = A::OuterStrideAtCompileTime }; +}; +templateclass P : H +{ +public: + using H::operator *; + typedef typename A::Scalar Scalar; + enum + { RowsAtCompileTime = + A::RowsAtCompileTime, ColsAtCompileTime = + A::ColsAtCompileTime, SizeAtCompileTime = + F::ret, MaxRowsAtCompileTime = + A::MaxRowsAtCompileTime, MaxColsAtCompileTime = + A::MaxColsAtCompileTime, MaxSizeAtCompileTime = + F::ret, Flags = + A::Flags ? : 0 ? : 0, CoeffReadCost = + A::CoeffReadCost, InnerStrideAtCompileTime = + J::ret, OuterStrideAtCompileTime = K::ret }; + B operator << (const Scalar&); +}; + +templateclass O : public P +{}; + +templateclass L +{ +public: + + int cols() + { + return _Cols; + } +}; +templateclass Q : public G::type +{ +public: + typedef typename G::type Base; + typedef typename A::Index Index; + typedef typename A::Scalar Scalar; + L m_storage; + Index cols() + { + return m_storage.cols(); + } + + Scalar& coeffRef(Index, + Index); +}; + +templatestruct A > +{ + typedef _Scalar Scalar; + typedef int Index; + enum + { RowsAtCompileTime, ColsAtCompileTime = + _Cols, MaxRowsAtCompileTime, MaxColsAtCompileTime, Flags = + D::ret, CoeffReadCost = + I::ReadCost, InnerStrideAtCompileTime, OuterStrideAtCompileTime = + 0 ? : 0 }; +}; +templateclass N : public Q > +{ +public: + Q Base; + templateN(const T0&, + const T1&); +}; +void +__assert_fail(int) +throw() __attribute__((__noreturn__)); +templatestruct B +{ + typedef typename XprType::Scalar Scalar; + typedef typename XprType::Index Index; + B(XprType & p1, const Scalar &) : m_xpr(p1), m_col(), + m_currentBlockRows(1) + {} B& operator, (const Scalar&) + { + Index a; + + if (m_col == m_xpr.cols()) + { + m_col = 0; + m_currentBlockRows = 1; + a && "Too " ? static_cast(0) : __assert_fail(0); + } + m_col < m_xpr.cols() + && "Too " ? static_cast(0) : __assert_fail(1); + m_currentBlockRows ? static_cast(0) : __assert_fail(4); + m_xpr.coeffRef(0, m_col++) = 0; + return *this; + } + ~B() + { + 1 + m_currentBlockRows && m_col + && "Too " ? static_cast(0) : __assert_fail(0); + } + + XprType& m_xpr; + Index m_col; + Index m_currentBlockRows; +}; + +templateBP< + Derived >::operator << (const Scalar&) +{ + return B(*static_cast(this), 0); +} + +templatevoid + check_() +{ + Nm(0, 0); + m << 0, 0, 0, 0; +} + +templatevoid check() +{ + check_(); +} + +int main() +{ + check(); +} -- cgit v1.2.3