Fixes #35578.
(This is https://github.com/CaseyCarter/libcxx/tree/fix_35578)
Differential D41048
[libcxx] workaround PR 28385 in __find_exactly_one_checked CaseyCarter on Dec 9 2017, 9:18 AM. Authored by
Details
Diff Detail Event TimelineComment Actions Four of the existing variant tests fail without this change (Using the clang-6 dailies from apt.llvm.org and -std=c++2a): Failing Tests (4): libc++ :: std/utilities/variant/variant.get/get_if_type.pass.cpp libc++ :: std/utilities/variant/variant.get/get_type.pass.cpp libc++ :: std/utilities/variant/variant.get/holds_alternative.pass.cpp libc++ :: std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp Expected Passes : 36 Unexpected Failures: 4 I think that's plenty of test coverage.
Comment Actions What about the repro for #35578? That repro and these four tests trigger the bug for me (no matching function for call to '__find_idx'...could not match "const bool" against "const bool") with clang version 6.0.0-svn320282-1~exp1 (trunk) freshly updated from apt.llvm.org on Ubuntu trusty running atop Windows Subsystem for Linux. (We've been shipping a workaround for 28385 in MSFT <variant> forever, and in range-v3 for even longer.) Both Godbolt and Wandbox agree. Comment Actions What we've been trying to convey is, none of the current tests with current default params trigger the problem. Comment Actions Ah - that was the factor I was missing. Casey's original post said they fail with 2a, and I'm *still* not seeing that. Comment Actions They fail for me both with -std=c++2a and -std=c++17. (The wandbox Comment Actions Hide the ugly version test in <__config>, define a slightly-more-meaningful macro _LIBCPP_WORKAROUND_CLANG_28385.
Comment Actions This unconditional workaround addresses Marshall's concerns about the naked version test. Comment Actions Reproduced with lit -sv --param=cxx_under_test="$HOME/bin/clang++" test/std/utilities/tuple/ lit: [...] note: Using available_features: ['libc++', 'verify-support', 'clang-6', 'modules-support', 'locale.en_US.UTF-8', 'diagnose-if-support', 'long_tests', 'fdelayed-template-parsing', '-faligned-allocation', 'locale.zh_CN.UTF-8', 'c++2a', 'locale.fr_CA.ISO8859-1', 'c++filesystem', 'c++experimental', 'clang', 'locale.fr_FR.UTF-8', 'locale.ru_RU.UTF-8', 'fsized-deallocation', 'freebsd11', 'fcoroutines-ts', 'locale.cs_CZ.ISO8859-2', 'clang-6.0', 'thread-safety'] Comment Actions This new-and-improved workaround - thanks to @lichray - is unintrusive enough that I can't imagine it being unnacceptable to anyone. I'm going to go ahead and check this in. |
We try not to have naked tests like this in the code.
If we have to, maybe:
#if defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER > 500 && _LIBCPP_STD_VER > 14
but I would rather define a new macro in <__config> and give it a meaningful name.