mirrored from git://gcc.gnu.org/git/gcc.git
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2017-02-19 Dinka Ranns <dinka.ranns@googlemail.com> C++17 GB50 resolution * include/std/chrono (duration::operator++()): Add _GLIBCXX17_CONSTEXPR. (duration::operator++(int)): Likewise. (duration::operator--()): Likewise. (duration::operator--(int)): Likewise. (duration::operator+=(const duration&)): Likewise. (duration::operator-=(const duration&)): Likewise. (duration::operator*=(const rep&)): Likewise. (duration::operator/=(const rep&)): Likewise. (duration::operator%=(const rep&)): Likewise. (duration::operator%=(const duration&)): Likewise. (time_point::operator+=(const duration&)): Likewise. (time_point::operator-=(const duration&)): Likewise. * testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: New test. * testsuite/20_util/duration/literals/range.cc: Adjust dg-error. * testsuite/20_util/time_point/arithmetic/constexpr.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245575 138bc75d-0d04-0410-961f-82ee72b054a4
- Loading branch information
redi
committed
Feb 19, 2017
1 parent
ac8df55
commit e8e98af
Showing
5 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
libstdc++-v3/testsuite/20_util/duration/arithmetic/constexpr_c++17.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// { dg-options "-std=gnu++17" } | ||
// { dg-do compile { target c++1z } } | ||
|
||
// Copyright (C) 2011-2017 Free Software Foundation, Inc. | ||
// | ||
// This file is part of the GNU ISO C++ Library. This library is free | ||
// software; you can redistribute it and/or modify it under the | ||
// terms of the GNU General Public License as published by the | ||
// Free Software Foundation; either version 3, or (at your option) | ||
// any later version. | ||
|
||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License along | ||
// with this library; see the file COPYING3. If not see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
#include <chrono> | ||
#include <testsuite_common_types.h> | ||
constexpr auto test_operators() | ||
{ | ||
std::chrono::nanoseconds d1 { 1 }; | ||
d1++; | ||
++d1; | ||
d1--; | ||
--d1; | ||
|
||
auto d2(d1); | ||
|
||
d1+=d2; | ||
d1-=d2; | ||
|
||
d1*=1; | ||
d1/=1; | ||
d1%=1; | ||
d1%=d2; | ||
|
||
return d1; | ||
} | ||
|
||
constexpr auto d4 = test_operators(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
libstdc++-v3/testsuite/20_util/time_point/arithmetic/constexpr.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// { dg-options "-std=gnu++17" } | ||
// { dg-do compile { target c++1z } } | ||
|
||
// Copyright (C) 2011-2016 Free Software Foundation, Inc. | ||
// | ||
// This file is part of the GNU ISO C++ Library. This library is free | ||
// software; you can redistribute it and/or modify it under the | ||
// terms of the GNU General Public License as published by the | ||
// Free Software Foundation; either version 3, or (at your option) | ||
// any later version. | ||
|
||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License along | ||
// with this library; see the file COPYING3. If not see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
#include <chrono> | ||
#include <testsuite_common_types.h> | ||
constexpr auto test_operators() | ||
{ | ||
using namespace std::chrono; | ||
nanoseconds d1 { }; | ||
time_point<system_clock> c1 { }; | ||
|
||
c1+=d1; | ||
c1-=d1; | ||
|
||
|
||
return 11; | ||
} | ||
|
||
constexpr auto a = test_operators(); |