Closed hacst closed 9 years ago
Hi. While watching one of your C++14 videos (those are nicely produced btw.) I noticed one of your examples narrowing a double to int (https://github.com/SuperV1234/Tutorials/blob/master/DiveIntoC%2B%2B14/1_CPP14/p4.cpp#L23). This is not allowed by the standard.
With clang 3.6 I get:
p4.cpp:19:28: error: type 'double' cannot be narrowed to 'int' in initializer list [-Wc++11-narrowing] template<typename T> T pi{3.14159265359}; ^~~~~~~~~~~~~
Thanks for reporting this mistake, I can reproduce it. Sorry for the incorrect piece of code!
I commented the wrong line and added a note in p4.cpp.
p4.cpp
Hi. While watching one of your C++14 videos (those are nicely produced btw.) I noticed one of your examples narrowing a double to int (https://github.com/SuperV1234/Tutorials/blob/master/DiveIntoC%2B%2B14/1_CPP14/p4.cpp#L23). This is not allowed by the standard.
With clang 3.6 I get: