Skip to content

Conversation

@stefan-it
Copy link

@stefan-it stefan-it commented Aug 31, 2016

This PR fixes a clang compiler bug in argument deduction:

....
test_binary.cpp:51:17: error: call to 'load' is ambiguous
    auto t_in = usb::load<T>(is);
                ^~~~~~~~~~~~
./load.hpp:31:7: note: candidate function [with T = std::__cxx11::basic_string<char>, $1 = <>]
    T load(std::ifstream& in) {
      ^
./load.hpp:37:7: note: candidate function [with T = std::__cxx11::basic_string<char>, $1 = <>]
    T load(std::ifstream& in) {
      ^
./load.hpp:43:7: note: candidate function [with T = std::__cxx11::basic_string<char>, $1 = <>]
    T load(std::ifstream& in) {
      ^
./load.hpp:49:7: note: candidate function [with T = std::__cxx11::basic_string<char>, $1 = <>]
    T load(std::ifstream& in) {
      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

See [1] for further information. With this patch compilation on clang with the latest version 3.8 works without problems, tested on Arch Linux:

$ clang++ --version
clang version 3.8.1 (tags/RELEASE_381/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ rake
clang++ -std=c++11 -Wall -Wextra test_binary.cpp -o test_binary.test
./test_binary.test
All tests run successful.

[1] https://llvm.org/bugs/show_bug.cgi?id=11723

@xdbr
Copy link
Owner

xdbr commented Sep 1, 2016

oh thanks @stefan-it! i will need to have a closer look at this before merging it in, hope to get to it soon!

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.

2 participants