summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/20090329-1.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/torture/20090329-1.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/torture/20090329-1.C')
-rw-r--r--gcc/testsuite/g++.dg/torture/20090329-1.C59
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/20090329-1.C b/gcc/testsuite/g++.dg/torture/20090329-1.C
new file mode 100644
index 000000000..0274a1944
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/20090329-1.C
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+
+struct input_iterator_tag { };
+template<typename _Category, typename _Tp, typename _Distance = long, typename _Pointer = _Tp*, typename _Reference = _Tp&>
+struct iterator {
+ typedef _Category iterator_category;
+};
+template<typename _Iterator> struct iterator_traits {
+ typedef typename _Iterator::iterator_category iterator_category;
+};
+template<typename, typename> struct __lc_rai {
+ template<typename _II1, typename _II2>
+ static _II1 __newlast1(_II1, _II1 __last1, _II2, _II2) {
+ return __last1;
+ }
+ template<typename _II>
+ static bool __cnd2(_II __first, _II __last) {
+ return __first != __last;
+ }
+};
+template<typename _II1, typename _II2, typename _Compare>
+bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2,
+ _II2 __last2, _Compare __comp) {
+ typedef typename iterator_traits<_II1>::iterator_category _Category1;
+ typedef typename iterator_traits<_II2>::iterator_category _Category2;
+ typedef __lc_rai<_Category1, _Category2> __rai_type;
+ __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
+ for (;
+ __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
+ ++__first1, ++__first2) {
+ if (__comp(*__first1, *__first2)) return true;
+ }
+}
+void __assert_fail () throw () __attribute__ ((__noreturn__));
+template<typename T> struct BoundsContainer { };
+template<class T> class input_iterator_wrapper : public iterator<input_iterator_tag, T, long, T*, T&> {
+public:
+ typedef BoundsContainer<T> ContainerType;
+ T* ptr;
+ ContainerType* SharedInfo;
+ input_iterator_wrapper(const input_iterator_wrapper& in) : ptr(in.ptr), SharedInfo(in.SharedInfo) { }
+ bool operator==(const input_iterator_wrapper& in) const {
+ (static_cast<void> ((SharedInfo != __null
+ && SharedInfo == in.SharedInfo)
+ ? 0 : (__assert_fail (), 0)));
+ }
+ bool operator!=(const input_iterator_wrapper& in) const {
+ return !(*this == in);
+ }
+ T& operator*() const { }
+ input_iterator_wrapper& operator++() { }
+};
+struct X { };
+bool predicate(const X&, const X&) {
+ return true;
+}
+bool test2(input_iterator_wrapper<X>& x) {
+ return lexicographical_compare(x, x, x, x, predicate);
+}