We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Just a couple of small fixes to allow Matplotlib to compile with -std=c++11. The problem is that C++11 does not allow implicit narrowing conversions (in this case, a cast from size_t, which is unsigned, to npy_intp, which is signed) in an initialiser list.
I was getting errors compiling these files with clang and -std=c++11:
lib/matplotlib/tri/_tri.cpp:280:25: error: non-constant-expression cannot be narrowed from type 'size_type' (aka 'unsigned long') to 'npy_intp' (aka 'long') in initializer list lib/matplotlib/tri/_tri.cpp:574:29: error: non-constant-expression cannot be narrowed from type 'size_type' (aka 'unsigned long') to 'npy_intp' (aka 'long') in initializer list src/_path.cpp:1356:33: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'npy_intp' (aka 'long') in initializer list
This patch fixes those errors. Note that GCC 4.6 with -std=c++0x does not catch this error, even though it violates the new specification. I don't know if GCC 4.7 has fixed this, but in any case, it is good to be future-proof.
Sorry, something went wrong.
_tri.cpp: Add explicit narrowing casts, to avoid C++11 compiler error.
8b4b026
_path.cpp: Add explicit narrowing casts, to avoid C++11 compiler error.
913b460
Thanks for taking the trouble to track this down. These look reasonable.
+1
Merge pull request #1434 from mgiuca-google/c++-11-narrowing
c63f671
C++11 narrowing conversions
c6 8000 3f671
Thanks, Ian.
Successfully merging this pull request may close these issues.