Stl: <exception>: std::exception::what has wrong signature

Created on 1 Jul 2020  路  1Comment  路  Source: microsoft/STL

Describe the bug
std::exception::what is not noexcept.
See also #882 - should probably be fixed together. #808 is also in similar area

Command-line test case


d:\Temp2>type repro.cpp
#include <cstdio>
#include <exception>

int main()
{
    auto b = noexcept(std::exception{}.what());
    std::printf("%d\n", (int)b);
}


d:\Temp2>cl /EHsc /permissive- /std:c++latest /Zc:__cplusplus /Zc:externConstexpr repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29009.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.

repro.cpp
Microsoft (R) Incremental Linker Version 14.27.29009.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:repro.exe
repro.obj

d:\Temp2>.\repro.exe
0

Expected behavior
Should print 1 as ctor is noexcept.

STL version

Microsoft Visual Studio Professional 2019 Preview
Version 16.7.0 Preview 3.1

Additional context
This item is also tracked on Developer Community as DevCom-785027 and by Microsoft-internal VSO-1006425 / AB#1006425.

vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.

bug vNext

>All comments

Thanks, I've linked the Microsoft-internal bug to this issue. This is a rare example of a vNext bug where the bincompat break isn't nearly as bad as the source-compat break (as it breaks every pre-noexcept override of what()).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

malkia picture malkia  路  10Comments

StephanTLavavej picture StephanTLavavej  路  12Comments

StephanTLavavej picture StephanTLavavej  路  10Comments

ohhmm picture ohhmm  路  32Comments

ned14 picture ned14  路  41Comments