This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/54025] New: atomic<chrono::duration> won't compile: chrono::duration::duration() is not C++11 compliant


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()â


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]