-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!
Description
Describe the bug
error_category's default ctor isn't constexpr.
Command-line test case
C:\Temp>type test.cpp
#include <system_error>
#include <type_traits>
#include <string>
#include <cassert>
class test1
: public std::error_category
{
public:
constexpr test1() = default; // won't compile if error_category() is not constexpr
virtual const char* name() const noexcept {return nullptr;}
virtual std::string message(int) const {return std::string();}
};
int main(int, char**)
{
static_assert(std::is_nothrow_default_constructible<test1>::value,
"error_category() must exist and be noexcept");
return 0;
}
C:\Temp>cl /EHsc /W4 /WX /std:c++latest test.cpp
Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.27.29109 для x64
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
/std:c++latest предоставляется как предварительная версия языковых функций из последнего
рабочего черновика C++. Мы приветствуем сообщения об ошибках и предложения к улучшению.
Однако обратите внимание, что эти функции предоставляются как есть, без поддержки и могут
измениться или быть удалены по мере развития рабочего черновика. Дополнительные сведения:
https://go.microsoft.com/fwlink/?linkid=2045807.
test.cpp
Microsoft (R) Incremental Linker Version 14.27.29109.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
C:\Temp>.\test.exe
Expected behavior
Should not compile now and should compile when error_category constructor will be constexpr
STL version
Microsoft Visual Studio Community 2019 Preview Version 16.7.0 Preview 6.0
Additional context
STL/tests/libcxx/expected_results.txt
Lines 634 to 635 in 06827fe
| # STL Bug: error_category's default ctor isn't constexpr. (Should be fixed in vNext.) | |
| std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp:1 FAIL |
Line 70 in e000d3f
| /* constexpr */ error_category() noexcept { // TRANSITION, ABI |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!