https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65499

            Bug ID: 65499
           Summary: Missing "using namespace literals::chrono_literals" in
                    std::chrono
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marejde at gmail dot com

Reading http://en.cppreference.com/w/cpp/chrono/operator%22%22min (sorry, I do
not have the spec readily available) it says:

"In addition, within the namespace std::chrono, the directive using namespace
literals::chrono_literals; is provided by the standard library, so that if a
programmer uses using namespace std::chrono; to gain access to the duration
classes, the duration literal operators become visible as well."

The following program:

#include <chrono>
#include <iostream>

int main(void)
{
    using namespace std::chrono;
    minutes min = 36min;
    return 0;
}

Does not compile with GCC 4.9.2 while it does with Clang 3.6.

Looking at GCC trunk as of today I do not see a "using namespace
literals::chrono_literals;" anywhere in libstdc++-v3/include/ . Clang's libc++
has it in the chrono namespace though.

Would be great if this could be fixed before GCC 5.0 is released so I don't
have to sprinkle "using namespace literals::chrono_literals;" in my code to be
able to compile with GCC.

Reply via email to