- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a cut down demo for a bug I found with C++ 2016. The program dies at runtime at the stream.imbue call. If the E function is not marked inline it works fine.
// Intel C++ 2016 locale imbue bug demo // Compiled with: // icl /Qstd=c++11 /Wall /Od imbue.cc #include <cstddef> #include <iomanip> #include <iostream> #include <sstream> #include <string>
inline // Works without inline std::string E( double const t, std::size_t w ) { std::cout << "E.1" << std::endl; //////////// static auto np( new std::num_put< char > ); static std::locale const loc( std::locale(), np ); std::ostringstream stream; std::cout << "E.2" << std::endl; //////////// stream.imbue( loc ); std::cout << "E.3" << std::endl; //////////// stream << std::showpoint << std::setw( w ) << t; return stream.str(); }
int main() { std::cout << E( 0.01, 24ul ) << std::endl; }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Staurt,
Thank you for reporting the issue, I can reproduce the issue with VS2012 and VS2015 both (the issue is not related to VS version).
And it works with Intel compiler 2015 but failed with 2016 only.
I'll report the issue to dev team to fix.
By the way, I see a ticket with same issue submitted by you in premier support, I'll close the issue in this forum and update you future information in premier support.
Thanks,
Shenghong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I posted here as well for other developers' benefit and I'll update this thread with new information.
Stuart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A work-around I found is to move the function-local static variables to namespace variables.
Another work-around is to make them non-static but that has a serious performance impact so it isn't practical for my purposes.
The actual E function is a template and in that case removing the inline doesn't help.
Stuart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Stuart,
Thank you for the information, I'll also pass these feedback to dev team for reference.
Shenghong

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page