Skip to content

Conversation

@4kangjc
Copy link

@4kangjc 4kangjc commented Jul 5, 2023

When using C++17 to call the function crc32::Crc32c, and the parameter type is const char*, there is ambiguity.

When using C++17 to call the function `crc32::Crc32c`, and the parameter type is `const char*`, there is ambiguity.
@4kangjc 4kangjc changed the title fix: calling function crc32::Crc32c is ambiguous fix: call to crc32::Crc32c is ambiguous Jul 5, 2023
@4kangjc
Copy link
Author

4kangjc commented Jul 5, 2023

$ cat test.cc
#include <string>

void f(std::string_view str) {}
void f(const std::string& str) {}

int main() {
  f("Hello World!");
}

$ g++ test.cc -std=c++17
test.cc:7:3: error: call to 'f' is ambiguous
  f("Hello World!");
  ^
test.cc:3:6: note: candidate function
void f(std::string_view str) {}
     ^
test.cc:4:6: note: candidate function
void f(const std::string& str) {}
     ^
1 error generated.

@4kangjc
Copy link
Author

4kangjc commented Jul 8, 2023

Hello, @pwnall.
Please review the code.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant