Skip to content

Can not compile with clang 16 and libc++ #2241

@owent

Description

@owent

Describe your environment

OS: Linux
Compiler: Clang 16.0.6 with libc++

What is the actual behavior?

[ 50%] Building CXX object sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/simple_log_record_processor_factory.cc.o
In file included from /data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/logs/simple_log_record_processor_factory.cc:6:
In file included from /data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h:8:
In file included from /opt/llvm-16.0/bin/../include/c++/v1/memory:898:
In file included from /opt/llvm-16.0/bin/../include/c++/v1/__memory/shared_ptr.h:31:
/opt/llvm-16.0/bin/../include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of 'sizeof' to an incomplete type 'opentelemetry::sdk::logs::LogRecordExporter'
    static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
                  ^~~~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__memory/unique_ptr.h:297:7: note: in instantiation of member function 'std::default_delete<opentelemetry::sdk::logs::LogRecordExporter>::operator()' requested here
      __ptr_.second()(__tmp);
      ^
/opt/llvm-16.0/bin/../include/c++/v1/__memory/unique_ptr.h:263:75: note: in instantiation of member function 'std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter>::reset' requested here
  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
                                                                          ^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h:36:3: note: in instantiation of member function 'std::unique_ptr<opentelemetry::sdk::logs::LogRecordExporter
>::~unique_ptr' requested here
  ~SimpleLogRecordProcessor() override = default;
  ^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h:36:3: note: in defaulted destructor for 'opentelemetry::sdk::logs::SimpleLogRecordProcessor' first required 
here
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h:17:7: note: forward declaration of 'opentelemetry::sdk::logs::LogRecordExporter'
class LogRecordExporter;
      ^
1 error generated.
gmake[2]: *** [sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/build.make:188: sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/simple_log_record_processor_factory.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:615: sdk/src/logs/CMakeFiles/opentelemetry_logs.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
'/opt/cmake/bin/cmake' '--build' '.'

[ 29%] Building CXX object sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/data/circular_buffer.cc.o
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned char>' requested 
here
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned short>' requested
 here
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned int>' requested h
ere
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
/data/workspace/third_party/packages/opentelemetry-cpp-v1.10.0/sdk/src/metrics/data/circular_buffer.cc:58:5: error: no matching function for call to 'fill'
    std::fill(backing.begin(), backing.end(), static_cast<T>(0));
    ^~~~~~~~~
/opt/llvm-16.0/bin/../include/c++/v1/__functional/invoke.h:394:23: note: in instantiation of function template specialization 'opentelemetry::sdk::metrics::(anonymous namespace)::AdaptingIntegerArrayClear::operator()<unsigned long>' requested 
here
    { return          static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
                      ^
/opt/llvm-16.0/bin/../include/c++/v1/__bit_reference:422:1: note: candidate template ignored: could not match '__bit_iterator' against '__wrap_iter'
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value)
^
4 errors generated.
gmake[2]: *** [sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/build.make:328: sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/data/circular_buffer.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:588: sdk/src/metrics/CMakeFiles/opentelemetry_metrics.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
'/opt/cmake/bin/cmake' '--build' '.' '--verbose'

Additional context

The problem of std::fill may be the BUG of libc++.But we may use std::vector::assign to avoid this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions