[cfe-dev] [libcxx]chrono:397:19: error: binding of reference to type 'long long' to a value of type 'const long long'

soaliap soaliap at 126.com
Tue Jul 3 21:00:57 PDT 2012


I download libcxx code from
http://llvm.org/svn/llvm-project/libcxx/tags/RELAESE_30/final, then goto
${libcxx-path}/lib directory and executed ./buildit.

It default used clang++ to compile, but there were some errors:

------------------------------------------------------------
+ clang++ -c -g -Os -fPIC -std=c++0x -nostdinc++ -I../include
../src/chrono.cpp
In file included from ../src/chrono.cpp:10:
../include/chrono:397:19: error: binding of reference to type 'long long' to
a value of type 'const long long'
      drops qualifiers
                : __rep_(__r) {}
                  ^      ~~~
../include/chrono:330:16: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1, 1000000>
>::duration<long long>' requested here
        return _ToDuration(static_cast<typename _ToDuration::rep>(
               ^
../include/chrono:357:12: note: in instantiation of member function
      'std::__1::chrono::__duration_cast<std::__1::chrono::duration<long
long, std::__1::ratio<1, 1>>,
      std::__1::chrono::duration<long long &&, std::__1::ratio<1, 1000000>>,
std::__1::ratio<1000000, 1>, false,
      true>::operator()' requested here
    return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
           ^
../include/chrono:409:26: note: in instantiation of function template
specialization
      'std::__1::chrono::duration_cast<std::__1::chrono::duration<long
long &&, std::__1::ratio<1, 1000000>>, long
      long, std::__1::ratio<1, 1> >' requested here
                :
__rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
                         ^
../include/__config:186:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
../include/chrono:551:93: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1, 1000000>
>::duration<long long,
      std::__1::ratio<1, 1> >' requested here
    typename common_type<duration<_Rep1, _Period1>, duration<_Rep2,
_Period2> >::type __r = __lhs;
                                                                                           
^
../src/chrono.cpp:32:42: note: in instantiation of function template
specialization
      'std::__1::chrono::operator+<long long, std::__1::ratio<1, 1>, long
long, std::__1::ratio<1, 1000000> >'
      requested here
    return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
                                         ^
In file included from ../src/chrono.cpp:10:
../include/chrono:413:57: error: rvalue reference to type 'long long' cannot
bind to lvalue of type 'long long'
    _LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
                                                        ^~~~~~
../include/chrono:409:70: note: in instantiation of member function
'std::__1::chrono::duration<long long &&,
      std::__1::ratio<1, 1000000> >::count' requested here
                :
__rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
                                                                     ^
../include/chrono:551:93: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1, 1000000>
>::duration<long long,
      std::__1::ratio<1, 1> >' requested here
    typename common_type<duration<_Rep1, _Period1>, duration<_Rep2,
_Period2> >::type __r = __lhs;
                                                                                           
^
../src/chrono.cpp:32:42: note: in instantiation of function template
specialization
      'std::__1::chrono::operator+<long long, std::__1::ratio<1, 1>, long
long, std::__1::ratio<1, 1000000> >'
      requested here
    return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
                                         ^
In file included from ../src/chrono.cpp:10:
../include/chrono:307:16: error: no matching conversion for functional-style
cast from 'long long' to
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000>>'
        return _ToDuration(static_cast<typename
_ToDuration::rep>(__fd.count()));
              
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/chrono:357:12: note: in instantiation of member function
      'std::__1::chrono::__duration_cast<std::__1::chrono::duration<long
long, std::__1::ratio<1, 1000000>>,
      std::__1::chrono::duration<long long &&, std::__1::ratio<1, 1000000>>,
std::__1::ratio<1, 1>, true,
      true>::operator()' requested here
    return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
           ^
../include/chrono:409:26: note: in instantiation of function template
specialization
      'std::__1::chrono::duration_cast<std::__1::chrono::duration<long
long &&, std::__1::ratio<1, 1000000>>, long
      long, std::__1::ratio<1, 1000000> >' requested here
                :
__rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
                         ^
../include/__config:186:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
../include/chrono:552:12: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1, 1000000>
>::duration<long long,
      std::__1::ratio<1, 1000000> >' requested here
    __r += __rhs;
           ^
../src/chrono.cpp:32:42: note: in instantiation of function template
specialization
      'std::__1::chrono::operator+<long long, std::__1::ratio<1, 1>, long
long, std::__1::ratio<1, 1000000> >'
      requested here
    return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
                                         ^
../include/chrono:375:23: note: candidate constructor (the implicit copy
constructor) not viable: no known
      conversion from 'long long' to 'const std::__1::chrono::duration<long
long &&, std::__1::ratio<1, 1000000>>'
      for 1st argument;
class _LIBCPP_VISIBLE duration
                      ^
../include/chrono:375:23: note: candidate constructor (the implicit move
constructor) not viable: no known
      conversion from 'long long' to 'std::__1::chrono::duration<long long
&&, std::__1::ratio<1, 1000000>>' for
      1st argument;
class _LIBCPP_VISIBLE duration
                      ^
../include/chrono:390:18: note: candidate template ignored: substitution
failure [with _Rep2 = long long]
        explicit duration(const _Rep2& __r,
                 ^
../include/chrono:402:9: note: candidate template ignored: failed template
argument deduction
        duration(const duration<_Rep2, _Period2>& __d,
        ^
../include/chrono:387:31: note: candidate constructor not viable: requires 0
arguments, but 1 was provided
    _LIBCPP_INLINE_VISIBILITY duration() {} // = default;
                              ^
../include/chrono:397:19: error: binding of reference to type 'long long' to
a value of type 'const long long'
      drops qualifiers
                : __rep_(__r) {}
                  ^      ~~~
../include/chrono:330:16: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000000> >::duration<long long>' requested
      here
        return _ToDuration(static_cast<typename _ToDuration::rep>(
               ^
../include/chrono:357:12: note: in instantiation of member function
      'std::__1::chrono::__duration_cast<std::__1::chrono::duration<long
long, std::__1::ratio<1, 1>>,
      std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000000>>, std::__1::ratio<1000000000, 1>,
      false, true>::operator()' requested here
    return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
           ^
../include/chrono:409:26: note: in instantiation of function template
specialization
      'std::__1::chrono::duration_cast<std::__1::chrono::duration<long
long &&, std::__1::ratio<1, 1000000000>>,
      long long, std::__1::ratio<1, 1> >' requested here
                :
__rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
                         ^
../include/__config:186:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
../include/chrono:551:93: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000000> >::duration<long long,
      std::__1::ratio<1, 1> >' requested here
    typename common_type<duration<_Rep1, _Period1>, duration<_Rep2,
_Period2> >::type __r = __lhs;
                                                                                           
^
../src/chrono.cpp:122:42: note: in instantiation of function template
specialization
      'std::__1::chrono::operator+<long long, std::__1::ratio<1, 1>, long
long, std::__1::ratio<1, 1000000000> >'
      requested here
    return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
                                         ^
In file included from ../src/chrono.cpp:10:
../include/chrono:413:57: error: rvalue reference to type 'long long' cannot
bind to lvalue of type 'long long'
    _LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
                                                        ^~~~~~
../include/chrono:409:70: note: in instantiation of member function
'std::__1::chrono::duration<long long &&,
      std::__1::ratio<1, 1000000000> >::count' requested here
                :
__rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
                                                                     ^
../include/chrono:551:93: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000000> >::duration<long long,
      std::__1::ratio<1, 1> >' requested here
    typename common_type<duration<_Rep1, _Period1>, duration<_Rep2,
_Period2> >::type __r = __lhs;
                                                                                           
^
../src/chrono.cpp:122:42: note: in instantiation of function template
specialization
      'std::__1::chrono::operator+<long long, std::__1::ratio<1, 1>, long
long, std::__1::ratio<1, 1000000000> >'
      requested here
    return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
                                         ^
In file included from ../src/chrono.cpp:10:
../include/chrono:307:16: error: no matching conversion for functional-style
cast from 'long long' to
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000000>>'
        return _ToDuration(static_cast<typename
_ToDuration::rep>(__fd.count()));
              
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/chrono:357:12: note: in instantiation of member function
      'std::__1::chrono::__duration_cast<std::__1::chrono::duration<long
long, std::__1::ratio<1, 1000000000>>,
      std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000000>>, std::__1::ratio<1, 1>, true,
      true>::operator()' requested here
    return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
           ^
../include/chrono:409:26: note: in instantiation of function template
specialization
      'std::__1::chrono::duration_cast<std::__1::chrono::duration<long
long &&, std::__1::ratio<1, 1000000000>>,
      long long, std::__1::ratio<1, 1000000000> >' requested here
                :
__rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
                         ^
../include/__config:186:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
../include/chrono:552:12: note: in instantiation of function template
specialization
      'std::__1::chrono::duration<long long &&, std::__1::ratio<1,
1000000000> >::duration<long long,
      std::__1::ratio<1, 1000000000> >' requested here
    __r += __rhs;
           ^
../src/chrono.cpp:122:42: note: in instantiation of function template
specialization
      'std::__1::chrono::operator+<long long, std::__1::ratio<1, 1>, long
long, std::__1::ratio<1, 1000000000> >'
      requested here
    return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
                                         ^
../include/chrono:375:23: note: candidate constructor (the implicit copy
constructor) not viable: no known
      conversion from 'long long' to 'const std::__1::chrono::duration<long
long &&, std::__1::ratio<1,
      1000000000>>' for 1st argument;
class _LIBCPP_VISIBLE duration
                      ^
../include/chrono:375:23: note: candidate constructor (the implicit move
constructor) not viable: no known
      conversion from 'long long' to 'std::__1::chrono::duration<long long
&&, std::__1::ratio<1, 1000000000>>'
      for 1st argument;
class _LIBCPP_VISIBLE duration
                      ^
../include/chrono:390:18: note: candidate template ignored: substitution
failure [with _Rep2 = long long]
        explicit duration(const _Rep2& __r,
                 ^
../include/chrono:402:9: note: candidate template ignored: failed template
argument deduction
        duration(const duration<_Rep2, _Period2>& __d,
        ^
../include/chrono:387:31: note: candidate constructor not viable: requires 0
arguments, but 1 was provided
    _LIBCPP_INLINE_VISIBILITY duration() {} // = default;
                              ^
6 errors generated.
------------------------------------------------------------


--
View this message in context: http://clang-developers.42468.n3.nabble.com/libcxx-chrono-397-19-error-binding-of-reference-to-type-long-long-to-a-value-of-type-const-long-long-tp4025122.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list