Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD] Avoid buggy "should be explicitly initialized in the copy constructor" warning with gcc <= 8 #3087

Merged

Commits on Oct 8, 2024

  1. Avoid buggy "should be explicitly initialized in the copy constructor…

    …" warning with gcc <= 8
    
    gcc <= 8, when building with -Wextra (and -Werror) wrongly raises this:
    /data/mwrep/res/mdw/SIOTF/internal/opentelemetry_cpp/trace/18-0-0-7/include/opentelemetry/trace/default_span.h: In copy constructor 'opentelemetry::v1::trace::DefaultSpan::DefaultSpan(const opentelemetry::v1::trace::DefaultSpan&)':
    /data/mwrep/res/mdw/SIOTF/internal/opentelemetry_cpp/trace/18-0-0-7/include/opentelemetry/trace/default_span.h:70:3: error: base class 'class opentelemetry::v1::trace::Span' should be explicitly initialized in the copy constructor [-Werror=extra]
       DefaultSpan(const DefaultSpan &spn) noexcept : span_context_(spn.GetContext()) {}
       ^~~~~~~~~~~
    
    See on Compiler Explorer here: https://godbolt.org/z/ed5rv74nT
    
    I believe Jason Merrill fixed it in gcc for all gcc >= 9 with:
    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=f3f7cefecc833b4ab652215ceb8b408c21dca225;hp=777083bb806dbe31ab97002b7d445191d3ee7a2d
    
    Workaround this by calling explicitly the empty Span constructor.
    Romain-Geissler-1A committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    6c04bf2 View commit details
    Browse the repository at this point in the history