This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54025] New: atomic<chrono::duration> won't compile: chrono::duration::duration() is not C++11 compliant
- From: "chip at pobox dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Jul 2012 02:55:28 +0000
- Subject: [Bug libstdc++/54025] New: atomic<chrono::duration> won't compile: chrono::duration::duration() is not C++11 compliant
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54025
Bug #: 54025
Summary: atomic<chrono::duration> won't compile:
chrono::duration::duration() is not C++11 compliant
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: chip@pobox.com
Attempting to compile atomic<duration> fails, because the duration default
constructor is not " = default" as required by the standard, but instead
explicitly initializes its representation. Here is what libstdc++ says:
constexpr duration() : __r() { }
but here is what the standard says should be there, and if I make the change,
compilation succeeds:
constexpr duration() = default;
Test source:
#include <atomic>
#include <chrono>
using namespace std;
using namespace chrono;
int main() {
atomic<duration<long, micro>> dur;
}
Error before patch:
/usr/include/c++/4.7/atomic: In instantiation of âstruct
std::atomic<std::chrono::duration<long int, std::ratio<1ll, 1000000ll> > >â:
atdur.cc:6:35: required from here
/usr/include/c++/4.7/atomic:160:7: error: function âstd::atomic<_Tp>::atomic()
[with _Tp = std::chrono::duration<long int, std::ratio<1ll, 1000000ll> >]â
defaulted on its first declaration with an exception-specification that differs
from the implicit declaration âconstexpr std::atomic<std::chrono::duration<long
int, std::ratio<1ll, 1000000ll> > >::atomic()â