Describe the bug
Our inheritance implementation is allowing this to compile when it shouldn't.
Command-line test case
C:\Temp>type main.cpp
#include <complex>
#include <cassert>
int main ()
{
const std::complex<long double> cd(2.5, 3.5);
std::complex<float> cf = cd;
assert(cf.real() == cd.real());
assert(cf.imag() == cd.imag());
}
C:\Temp>cl /EHsc /W4 /WX main.cpp
Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.28.29213 для x64
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
main.cpp
Microsoft (R) Incremental Linker Version 14.28.29213.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
C:\Temp>main.exe
C:\Temp>type main.cpp
#include <complex>
#include <cassert>
int main ()
{
const std::complex<double> cd(2.5, 3.5);
std::complex<float> cf = cd;
assert(cf.real() == cd.real());
assert(cf.imag() == cd.imag());
}
C:\Temp>cl /EHsc /W4 /WX main.cpp
Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.28.29213 для x64
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
main.cpp
Microsoft (R) Incremental Linker Version 14.28.29213.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
C:\Temp>main.exe
C:\Temp>type main.cpp
#include <complex>
#include <cassert>
int main ()
{
const std::complex<long double> cd(2.5, 3.5);
std::complex<double> cf = cd;
assert(cf.real() == cd.real());
assert(cf.imag() == cd.imag());
}
C:\Temp>cl /EHsc /W4 /WX main.cpp
Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.28.29213 для x64
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
main.cpp
Microsoft (R) Incremental Linker Version 14.28.29213.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
C:\Temp>main.exe
Expected behavior
Compile time error
STL version
Microsoft Visual Studio Community 2019 Preview Version 16.8.0 Preview 2.0
Additional context
Skipped libcxx test
|
# STL bug: Our inheritance implementation is allowing this to compile when it shouldn't.
|
|
std/numerics/complex.number/complex.special/double_long_double_implicit.compile.fail.cpp FAIL
|
|
std/numerics/complex.number/complex.special/float_double_implicit.compile.fail.cpp FAIL
|
|
std/numerics/complex.number/complex.special/float_long_double_implicit.compile.fail.cpp FAIL
|
Describe the bug
Our inheritance implementation is allowing this to compile when it shouldn't.
Command-line test case
Expected behavior
Compile time error
STL version
Microsoft Visual Studio Community 2019 Preview Version 16.8.0 Preview 2.0Additional context
Skipped libcxx test
STL/tests/libcxx/expected_results.txt
Lines 557 to 560 in 06827fe