-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
I have basically #952 (comment) with a namespace:
#include <fmt/ostream.h>
#include <iostream>
namespace something{ struct Custom {}; }
std::ostream& operator<<(std::ostream& os, const something::Custom&)
{
return os << "Ok";
}
int main()
{
// Compiles with Gcc and Clang
std::cout << something::Custom() << '\n';
// Compiles with Gcc, but not Clang
fmt::print("{}\n", something::Custom());
}
I don't know if this is a compiler bug, but it seems that clang + libfmt = operator<<
not found.
The absurd thing is that it compiles (with both compilers, also the non-libfmt example) if I move operator<<
into the namespace. That is not supposed to compile (if my understanding of argument dependent lookup is correct) – I learned this from the exact opposite experience.
Libfmt tested:
- libfmt 6.1.2-1.2 (OpenSuse package)
- latest git (dc22360)
Compilers tested:
- g++ 9.2.1
- g++ 7.4.1
- clang++ 9.0.0
- clang++ 6.0.1
Metadata
Metadata
Assignees
Labels
No labels