reverse_iterator.fail.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
10b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor//===----------------------------------------------------------------------===//
20b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor//
30b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor//                     The LLVM Compiler Infrastructure
40b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor//
50b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor// This file is distributed under the University of Illinois Open Source
60b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor// License. See LICENSE.TXT for details.
70b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor//
80b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor//===----------------------------------------------------------------------===//
90b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor
100b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor// <iterator>
110b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor
120b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor// reverse_iterator
132a7fb27913999d132cf9e10e03dc5271faa2e9d3John McCall
1455fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth// template <class U>
150b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor//   requires HasAssign<Iter, const U&>
16d6992ab33b7113e1bd7af51c0c52d17c23706c01Faisal Vali//   reverse_iterator&
177cd088e519d7e6caa4c4c12db52e0e4ae35d25c2John McCall//   operator=(const reverse_iterator<U>& u);
180b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor
190b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor// test requires
200b9247f129401b4849682b2e2bcdea8fc977068aDouglas Gregor
2155fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth#include <iterator>
2255fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth
2355fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruthtemplate <class It, class U>
2455fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruthvoid
25013b3668b67c8cb3ad2ee516c5607a3eba11829fBenjamin Kramertest(U u)
268a51491d936d8c50480f3c3ca6647be12a7ad51fDouglas Gregor{
27508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor    const std::reverse_iterator<U> r2(u);
28508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor    std::reverse_iterator<It> r1;
292a7fb27913999d132cf9e10e03dc5271faa2e9d3John McCall    r1 = r2;
30508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor}
31508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor
32508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregorstruct base {};
33508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregorstruct derived {};
34508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor
35508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregorint main()
36508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor{
37508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor    derived d;
38508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor    test<base*>(&d);
39508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor}
40508f1c889b9833903ea394034fe0246d3a57a32dDouglas Gregor