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

Declaration order for etl::first_set_bit_position in binary.h #827

Closed
omar-droubi opened this issue Jan 24, 2024 · 1 comment
Closed

Declaration order for etl::first_set_bit_position in binary.h #827

omar-droubi opened this issue Jan 24, 2024 · 1 comment
Assignees
Labels

Comments

@omar-droubi
Copy link

When using the function etl::first_set_bit_position in binary.h, compilation fails due to declaration order. etl::first_set_bit_position relies on etl::count_trailing_zeros which is declared after wards.

#include "etl/binary.h"

int main()
{
    auto pos = etl::first_set_bit_position(0xAA);
    std::cout << pos << std::endl;
    return 0;
}
binary.h:354:12: error: call to function 'count_trailing_zeros' that is neither visible in the template definition nor found by argument-dependent lookup
    return count_trailing_zeros(value);
           ^
main.cpp:12:21: note: in instantiation of function template specialization 'etl::first_set_bit_position<int>' requested here
    auto pos = etl::first_set_bit_position(0xAA);
                    ^
bsw/common/etl/include/etl/binary.h:1361:5: note: 'count_trailing_zeros' should be declared prior to the call site
    count_trailing_zeros(T value)
    ^
1 error generated.

etl::first_set_bit_position definition should be moved till after the definition of etl::count_trailing_zeros.

@jwellbelove jwellbelove self-assigned this Jan 24, 2024
jwellbelove pushed a commit that referenced this issue Mar 4, 2024
@jwellbelove
Copy link
Contributor

Fixed 20.38.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants