After Jonathan Emmett (@joemmett) fixed internal VSO-2742607 "C1XX __reference_constructs_from_temporary mishandles a couple of cases", there's a remaining point of divergence between C1XX and Clang in the test cases added by #5537. Fully reduced:
D:\GitHub\STL\out\x64>type meow.cpp
#include <type_traits>
struct to_int_prvalue_implicitly {
explicit(false) operator int() const;
};
struct to_int_prvalue_explicitly {
explicit(true) operator int() const;
};
static_assert(std::reference_constructs_from_temporary_v<const int&, to_int_prvalue_implicitly>);
static_assert(std::reference_constructs_from_temporary_v<const int&, to_int_prvalue_explicitly>);
D:\GitHub\STL\out\x64>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.51.36223.2 for x64 (PREVIEW)
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
D:\GitHub\STL\out\x64>cl /EHsc /nologo /W4 /std:c++latest /diagnostics:caret /c meow.cpp
meow.cpp
meow.cpp(12,20): error C2607: static assertion failed
static_assert(std::reference_constructs_from_temporary_v<const int&, to_int_prvalue_explicitly>);
^
D:\GitHub\STL\out\x64>clang-cl -v
clang version 20.1.8
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\Llvm\x64\bin
D:\GitHub\STL\out\x64>clang-cl /EHsc /nologo /W4 /std:c++latest /c meow.cpp
D:\GitHub\STL\out\x64>
I don't want to try to summarize Jonathan's analysis of this case, since I'll probably mangle it. I believe this is related to a Core issue that we didn't get a response about on the CWG reflector, and we haven't yet rounded up a Clang dev to talk to Jonathan and see if we can get some kind of agreement about what the correct answer should be here. So, I'm filing this tracking issue.
After Jonathan Emmett (@joemmett) fixed internal VSO-2742607 "C1XX
__reference_constructs_from_temporarymishandles a couple of cases", there's a remaining point of divergence between C1XX and Clang in the test cases added by #5537. Fully reduced:I don't want to try to summarize Jonathan's analysis of this case, since I'll probably mangle it. I believe this is related to a Core issue that we didn't get a response about on the CWG reflector, and we haven't yet rounded up a Clang dev to talk to Jonathan and see if we can get some kind of agreement about what the correct answer should be here. So, I'm filing this tracking issue.