Merged revisions 143552,143554,143557,143560,143562,143564-143567,143570-143573,14357...
[official-gcc.git] / libstdc++-v3 / testsuite / 20_util / duration / cons / 1_neg.cc
blob5c84f309509345470a614e96d56e33988af84598
1 // { dg-do compile }
2 // { dg-options "-std=gnu++0x" }
3 // { dg-require-cstdint "" }
5 // Copyright (C) 2008, 2009 Free Software Foundation
6 //
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 2, or (at your option)
11 // any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING. If not, write to the Free
20 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // USA.
23 // 20.8.3.1 duration constructors [time.duration.cons]
25 #include <chrono>
27 void
28 test01()
30 std::chrono::duration<int> d1(1.0);
33 void
34 test02()
36 using namespace std::chrono;
38 duration<int, std::micro> d2(8);
39 duration<int, std::milli> d2_copy(d2);
42 // { dg-error "instantiated from here" "" { target *-*-* } 30 }
43 // { dg-error "instantiated from here" "" { target *-*-* } 39 }
44 // { dg-error "not exactly representable" "" { target *-*-* } 232 }
45 // { dg-error "integral duration with floating point" "" { target *-*-* } 222 }
46 // { dg-excess-errors "In instantiation of" }