Quantcast

Problem with gnu libc++ 4.7's chrono in Clang 3.2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with gnu libc++ 4.7's chrono in Clang 3.2

Martin Martin
Hi,

Compiling the following 1-line file:

#include <condition_variable>

Causes the error:

$ clang++ -std=c++11 ./foo.cpp
In file included from ./foo.cpp:1:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/condition_variable:37:
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:539:6: error: no matching constructor for
      initialization of 'duration' (aka 'std::chrono::duration<long, std::ratio<1, 1000000> >')
          : __d(__t.time_since_epoch())
            ^   ~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/condition_variable:110:42: note: in instantiation of
      function template specialization 'std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<long,
      std::ratio<1, 1000000> > >::time_point<std::chrono::duration<long, std::ratio<1, 1000000000> > >' requested here
        const __clock_t::time_point __s_atime = __s_entry + __delta;
                                                ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:233:12: note: candidate constructor not viable: no
      known conversion from 'duration<[...], ratio<[...], 1000000000>>' to 'duration<[...], ratio<[...], 1000000>>'
      for 1st argument
        constexpr duration(const duration&) = default;
                  ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:239:23: note: candidate template ignored: couldn't
      infer template argument ''
          constexpr explicit duration(const _Rep2& __rep)
                             ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:246:14: note: candidate template ignored: couldn't
      infer template argument ''
          constexpr duration(const duration<_Rep2, _Period2>& __d)
                    ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:231:12: note: candidate constructor not viable:
      requires 0 arguments, but 1 was provided
        constexpr duration() : __r() { }
                  ^
1 error generated.

Searching the web doesn't turn up anything related.

This is on Ubuntu 12.10, with Clang branches/release_32 compiled from source in release mode.

Any idea what I should look at next?

Thanks,
Martin

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with gnu libc++ 4.7's chrono in Clang 3.2

Howard Hinnant
On Jan 3, 2013, at 11:36 AM, Martin Martin <[hidden email]> wrote:

> Hi,
>
> Compiling the following 1-line file:
>
> #include <condition_variable>
>
> Causes the error:
>
> $ clang++ -std=c++11 ./foo.cpp
> In file included from ./foo.cpp:1:
> In file included from /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/condition_variable:37:
> /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:539:6: error: no matching constructor for
>       initialization of 'duration' (aka 'std::chrono::duration<long, std::ratio<1, 1000000> >')
>           : __d(__t.time_since_epoch())
>             ^   ~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/condition_variable:110:42: note: in instantiation of
>       function template specialization 'std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<long,
>       std::ratio<1, 1000000> > >::time_point<std::chrono::duration<long, std::ratio<1, 1000000000> > >' requested here
>         const __clock_t::time_point __s_atime = __s_entry + __delta;
>                                                 ^
> /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:233:12: note: candidate constructor not viable: no
>       known conversion from 'duration<[...], ratio<[...], 1000000000>>' to 'duration<[...], ratio<[...], 1000000>>'
>       for 1st argument
>         constexpr duration(const duration&) = default;
>                   ^
> /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:239:23: note: candidate template ignored: couldn't
>       infer template argument ''
>           constexpr explicit duration(const _Rep2& __rep)
>                              ^
> /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:246:14: note: candidate template ignored: couldn't
>       infer template argument ''
>           constexpr duration(const duration<_Rep2, _Period2>& __d)
>                     ^
> /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:231:12: note: candidate constructor not viable:
>       requires 0 arguments, but 1 was provided
>         constexpr duration() : __r() { }
>                   ^
> 1 error generated.
>
> Searching the web doesn't turn up anything related.
>
> This is on Ubuntu 12.10, with Clang branches/release_32 compiled from source in release mode.
>
> Any idea what I should look at next?

This doesn't look like a clang issue.  The condition_variable code is trying to truncate a time_point based on nanoseconds into one based on microseconds, and <chrono> won't let you do that implicitly.  This is a bug in the condition_variable code that <chrono> has found at compile time.

Howard

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with gnu libc++ 4.7's chrono in Clang 3.2

Richard Smith
In reply to this post by Martin Martin

See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53841

On Jan 3, 2013 8:38 AM, "Martin Martin" <[hidden email]> wrote:
Hi,

Compiling the following 1-line file:

#include <condition_variable>

Causes the error:

$ clang++ -std=c++11 ./foo.cpp
In file included from ./foo.cpp:1:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/condition_variable:37:
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:539:6: error: no matching constructor for
      initialization of 'duration' (aka 'std::chrono::duration<long, std::ratio<1, 1000000> >')
          : __d(__t.time_since_epoch())
            ^   ~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/condition_variable:110:42: note: in instantiation of
      function template specialization 'std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<long,
      std::ratio<1, 1000000> > >::time_point<std::chrono::duration<long, std::ratio<1, 1000000000> > >' requested here
        const __clock_t::time_point __s_atime = __s_entry + __delta;
                                                ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:233:12: note: candidate constructor not viable: no
      known conversion from 'duration<[...], ratio<[...], 1000000000>>' to 'duration<[...], ratio<[...], 1000000>>'
      for 1st argument
        constexpr duration(const duration&) = default;
                  ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:239:23: note: candidate template ignored: couldn't
      infer template argument ''
          constexpr explicit duration(const _Rep2& __rep)
                             ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:246:14: note: candidate template ignored: couldn't
      infer template argument ''
          constexpr duration(const duration<_Rep2, _Period2>& __d)
                    ^
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/chrono:231:12: note: candidate constructor not viable:
      requires 0 arguments, but 1 was provided
        constexpr duration() : __r() { }
                  ^
1 error generated.

Searching the web doesn't turn up anything related.

This is on Ubuntu 12.10, with Clang branches/release_32 compiled from source in release mode.

Any idea what I should look at next?

Thanks,
Martin

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Loading...