Skip to content
New issue

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

Guard noexcept annotated function pointer type for __cpp_noexcept_function_type. #1150

Merged
merged 9 commits into from
Aug 13, 2020

Conversation

BillyONeal
Copy link
Member

Resolves VSO-1166234.

@BillyONeal BillyONeal requested a review from a team as a code owner August 5, 2020 10:05
@BillyONeal
Copy link
Member Author

Looks like there was another preexisting example in <any> I'll fix in the morning.

@CaseyCarter CaseyCarter added the bug Something isn't working label Aug 5, 2020
@AlexGuteniev
Copy link
Contributor

Didn't know there's such feature in C++17

@StephanTLavavej
Copy link
Member

@AlexGuteniev Despite improving the type system, this feature can be surprisingly obnoxious for migrating large codebases to C++17, hence the fine-grained escape hatch (which is quite rare).

The other place this shows up is in the STL's macro system that stamps out all possible specializations for function types (and pointer to member function types etc.) - when noexcept can appear in the type, we need more specializations.

@AlexGuteniev
Copy link
Contributor

But as I see, the VSO issue is triggered by absence of noexcept, not presence of it

@AlexGuteniev
Copy link
Contributor

Ah, I see. noexcept was left there. I thought I removed it, but I now remember Billy put it back after guarding atomic wait header with C++20

AlexGuteniev added a commit to AlexGuteniev/STL that referenced this pull request Aug 7, 2020
Note that VSO_0157762_feature_test_macros\env.lst is not updated despite the comment in usual_matrix because that would change feature test macros and we're not interested in testing that compiler difference.
@BillyONeal BillyONeal requested a review from CaseyCarter August 8, 2020 08:06
@AlexGuteniev
Copy link
Contributor

1: Command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\bin\HostX86\x86\cl.EXE" "/FeD:\build\x86\tests\std\tests\VSO_0105317_expression_sfinae\03\VSO_0105317_expression_sfinae.exe" "/FoD:\build\x86\tests\std\tests\VSO_0105317_expression_sfinae\03\VSO_0105317_expression_sfinae.obj" "/ID:\build\x86\out\inc" "/IC:/agent/_work/1/s/llvm-project/libcxx/test/support" "/IC:/agent/_work/1/s/tests/std/include" "/nologo" "/Od" "/W4" "/w14061" "/w14242" "/w14265" "/w14582" "/w14583" "/w14587" "/w14588" "/w14749" "/w14841" "/w14842" "/w15038" "/w15214" "/w15215" "/w15216" "/w15217" "/sdl" "/WX" "/Zc:strictStrings" "/D_ENABLE_STL_INTERNAL_CHECK" "/bigobj" "/FIforce_include.hpp" "/w14365" "/D_ENFORCE_FACET_SPECIALIZATIONS=1" "/EHsc" "/MD" "/D_ITERATOR_DEBUG_LEVEL=1" "/std:c++latest" "/w14640" "/Zc:threadSafeInit-" "/Zc:noexceptTypes-" "C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp" "/link" "/LIBPATH:D:\build\x86\out\lib\i386" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\lib\x86" "/MANIFEST:EMBED"
1: Exit Code: 2
1: Standard Output:
1: --
1: test.cpp
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(515): error C2279: exception specification cannot appear in a typedef declaration
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(516): error C2279: exception specification cannot appear in a typedef declaration
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(517): error C2279: exception specification cannot appear in a typedef declaration
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(522): error C2338: is_nothrow_invocable_v<FP_noexcept, int>
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(527): error C2338: is_nothrow_invocable_v<FR_noexcept, int>
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(536): error C2338: is_nothrow_invocable_v<PMF_noexcept, X, int>
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(538): error C2338: is_nothrow_invocable_v<PMF_noexcept, reference_wrapper<X>, int>
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(540): error C2338: is_nothrow_invocable_v<PMF_noexcept, X*, int>
1: C:\agent\_work\1\s\tests\std\tests\VSO_0105317_expression_sfinae\test.cpp(571): error C2338: is_nothrow_invocable_v<FP_noexcept, Okay_noexcept>
1: --

I guess this test part is not applicable for the /Zc:noexceptTypes- mode, should be guarded with __cpp_noexcept_function_type

1: Command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\bin\HostX86\x86\cl.EXE" "/FeD:\build\x86\tests\std\tests\Dev11_0535636_functional_overhaul\03\Dev11_0535636_functional_overhaul.exe" "/FoD:\build\x86\tests\std\tests\Dev11_0535636_functional_overhaul\03\Dev11_0535636_functional_overhaul.obj" "/ID:\build\x86\out\inc" "/IC:/agent/_work/1/s/llvm-project/libcxx/test/support" "/IC:/agent/_work/1/s/tests/std/include" "/nologo" "/Od" "/W4" "/w14061" "/w14242" "/w14265" "/w14582" "/w14583" "/w14587" "/w14588" "/w14749" "/w14841" "/w14842" "/w15038" "/w15214" "/w15215" "/w15216" "/w15217" "/sdl" "/WX" "/Zc:strictStrings" "/D_ENABLE_STL_INTERNAL_CHECK" "/bigobj" "/FIforce_include.hpp" "/w14365" "/D_ENFORCE_FACET_SPECIALIZATIONS=1" "/EHsc" "/MD" "/D_ITERATOR_DEBUG_LEVEL=1" "/std:c++latest" "/w14640" "/Zc:threadSafeInit-" "/Zc:noexceptTypes-" "C:\agent\_work\1\s\tests\std\tests\Dev11_0535636_functional_overhaul\test.cpp" "/link" "/LIBPATH:D:\build\x86\out\lib\i386" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\lib\x86" "/MANIFEST:EMBED"
1: Exit Code: 2
1: Standard Output:
1: --
1: test.cpp
1: C:\agent\_work\1\s\tests\std\tests\Dev11_0535636_functional_overhaul\test.cpp(1101): error C2338: noexcept(invoke(&Thing::sum_noexcept, *sp, 3) == 1023)
1: C:\agent\_work\1\s\tests\std\tests\Dev11_0535636_functional_overhaul\test.cpp(1103): error C2338: noexcept(invoke(&Thing::sum_noexcept, ref(*sp), 4) == 1024)
1: C:\agent\_work\1\s\tests\std\tests\Dev11_0535636_functional_overhaul\test.cpp(1105): error C2338: noexcept(invoke(&Thing::sum_noexcept, sp.get(), 5) == 1025)
1: C:\agent\_work\1\s\tests\std\tests\Dev11_0535636_functional_overhaul\test.cpp(1107): error C2338: noexcept(invoke(&Thing::sum_noexcept, sp, 6) == 1026)
1: C:\agent\_work\1\s\tests\std\tests\Dev11_0535636_functional_overhaul\test.cpp(1117): error C2338: noexcept(invoke(square_noexcept, 6) == 36)
1: C:\agent\_work\1\s\tests\std\tests\Dev11_0535636_functional_overhaul\test.cpp(1119): error C2338: noexcept(invoke(&cube_noexcept, 7) == 343)
1: --

I guess this test part is also not applicable for the /Zc:noexceptTypes- mode:
#if _HAS_CXX17 should be replaced with __cpp_noexcept_function_type

@CaseyCarter
Copy link
Contributor

Test failures appear to be due to static_assert(noexcept(/**/))s failures in tests/std/tests/Dev11_0535636_functional_overhaul with /Zc:noexceptTypes-.

@AlexGuteniev
Copy link
Contributor

I'd expect VSO_0105317_expression_sfinae to still fail

@BillyONeal
Copy link
Member Author

Yeah I pushed because I was rebooting to fix a hardware problem not because I think it's fixed yet.

@CaseyCarter CaseyCarter self-requested a review August 11, 2020 20:35
CaseyCarter added a commit to miscco/STL that referenced this pull request Aug 12, 2020
@CaseyCarter CaseyCarter self-assigned this Aug 13, 2020
@CaseyCarter CaseyCarter merged commit 87dc1d3 into microsoft:master Aug 13, 2020
@CaseyCarter
Copy link
Contributor

Thanks for fixing this nasty /Zc:noexceptTypes- bug.

@CaseyCarter CaseyCarter removed their assignment Aug 14, 2020
@BillyONeal BillyONeal deleted the noexcept_types branch September 23, 2020 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants