-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Better error messages #357
Comments
Thanks for the suggestions. I agree that it would be nice to improve error reporting in this case. The only problem is that the most general template-based overload is already taken for Line 72 in 0d5ef5c
Great blog post BTW! |
Hm, maybe disable it via expression SFINAE (on compilers that support it...)? |
Is this the "not exactly nice" error message? /usr/local/include/fmt/format.h:1182:5: error: no matching function for call to 'format' |
@xaxxon Yes, looks like it. |
Improved error reporting is implemented in 31e7e80. Now it will give:
|
That's awesome. On Sun, Aug 14, 2016 at 7:31 AM, Victor Zverovich notifications@github.com
|
(cherry picked from commit f19d8f9)
I'm trying to use fmt::hex and am seeing this error. I tried adding #include "fmt/ostream.h" and then get: external/fmtlib/fmt/ostream.h:82:10: error: invalid operands to binary expression ('std::basic_ostream' and 'const fmt::IntFormatSpec<unsigned int, fmt::TypeSpec<'x'>, char>')
|
It looks that you are trying to use fmt::hex with iostreams while it should be used with a writer. If this is not the case please post the code that causes the error. |
If you pass in a type that cannot be formatted, the error messages aren't.. exactly nice.
There are strategies to provide better error messages, namely a fallback functions that gets chosen as last resort with a static_assert() upon instantiation (I wrote a blog post if you are not aware of such techniques).
It would be nice if you implement something like this.
The text was updated successfully, but these errors were encountered: