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

Wshadow error in function_ref.h #2495

Closed
sfc-gh-sili opened this issue Jan 18, 2024 · 3 comments · Fixed by #2498
Closed

Wshadow error in function_ref.h #2495

sfc-gh-sili opened this issue Jan 18, 2024 · 3 comments · Fixed by #2498
Labels
bug Something isn't working

Comments

@sfc-gh-sili
Copy link

Describe your environment

CentoOS

Steps to reproduce

Compile with clang

What is the actual behavior?

bazel-out/aarch64-fastbuild-clang-tidy/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/nostd/function_ref.h:38:26: error: declaration shadows a field of 'function_ref<type-parameter-0-0 (type-parameter-0-1...)>' [-Werror,-Wshadow]
    invoker_  = [](void *callable_, Args... args) -> R {
                         ^
bazel-out/aarch64-fastbuild-clang-tidy/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/nostd/function_ref.h:28:9: note: previous declaration is here
  void *callable_                = nullptr;
        ^
bazel-out/aarch64-fastbuild-clang-tidy/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/nostd/function_ref.h:52:26: error: declaration shadows a field of 'function_ref<type-parameter-0-0 (type-parameter-0-1...)>' [-Werror,-Wshadow]
    invoker_  = [](void *callable_, Args... args) -> R {
                         ^
bazel-out/aarch64-fastbuild-clang-tidy/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/nostd/function_ref.h:28:9: note: previous declaration is here
  void *callable_                = nullptr;

Clang is complaining about shadowing declaration in function_ref.h

@sfc-gh-sili sfc-gh-sili added the bug Something isn't working label Jan 18, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 18, 2024
@marcalff
Copy link
Member

Thanks for the report.

This looks valid, based on code review.

Please clarify which version of clang is used, and which compiling options are used if possible.

It will help to figure out why our CI did not catch this, as there are special builds with clang to detect all warnings, and somehow this was not caught.

@marcalff marcalff changed the title Wshadow erorr in function_ref.h Wshadow error in function_ref.h Jan 18, 2024
@sfc-gh-sili
Copy link
Author

I believe the flag -Wshadow combined with -Werror is what triggers this error message. I didn't find anything related to shadowing in our options though.

@owent owent mentioned this issue Jan 21, 2024
3 tasks
@owent
Copy link
Member

owent commented Jan 21, 2024

Thanks, I also meet similar warnings with some old compilers in other repos before.
And I just raise a PR to fix this.

@marcalff marcalff removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants