From baa5b4a1760f9ca899f06c646d9880bf3d3e8644 Mon Sep 17 00:00:00 2001 From: Andreas Fertig Date: Wed, 18 Oct 2023 20:45:34 +0200 Subject: [PATCH] Fixed #593: Don't show casts for user defined conversions. --- .clang-format | 1 - CodeGenerator.cpp | 5 ++- tests/CharLiteralTest.expect | 38 +++++++++---------- tests/Class2Test.expect | 4 +- tests/ClassTest.expect | 4 +- tests/ConversionDeclTest.expect | 2 +- tests/CoroutinesCoReturnPlusTest.expect | 2 +- tests/EduCoroutineAllocFailureTest.expect | 2 +- tests/EduCoroutineBinaryExprTest.expect | 2 +- tests/EduCoroutineCaptureConstTest.expect | 2 +- tests/EduCoroutineCaptureThisTest.expect | 2 +- ...EduCoroutineCoreturnWithCoawaitTest.expect | 2 +- tests/EduCoroutineCustomYieldTypeTest.expect | 2 +- tests/EduCoroutineExprTest.expect | 6 +-- tests/EduCoroutineSimpleTest.expect | 2 +- tests/EduCoroutineSuspendNeverBoolTest.expect | 2 +- tests/EduCoroutineSuspendNeverTest.expect | 2 +- .../EduCoroutineTemplateGeneratorTest.expect | 2 +- tests/EduCoroutineVoidTest.expect | 2 +- tests/EduCoroutineWithDtorTest.expect | 2 +- ...duCoroutineWithExceptionHandlerTest.expect | 2 +- tests/EduCoroutineWithLambdaTest.expect | 2 +- tests/IfSwitchInitHandler5Test.expect | 2 +- tests/Issue324.expect | 2 +- tests/Issue467.expect | 4 +- tests/Issue491.expect | 2 +- tests/Issue518.expect | 6 +-- tests/Issue536.expect | 2 +- tests/Issue536_2.expect | 2 +- tests/Issue593.cpp | 4 ++ tests/Issue593.expect | 11 ++++++ tests/Issue92.expect | 2 +- tests/LambdaHandler2Test.expect | 2 +- tests/LambdaHandlerCaptureLessTest.cerr | 6 +-- tests/LambdaHandlerCaptureLessTest.expect | 2 +- tests/LambdaWithFunctionPointerTest.expect | 2 +- tests/LambdaWithStaticInvokerTest.cerr | 28 +++++++------- tests/LambdaWithStaticInvokerTest.expect | 8 ++-- tests/StringViewNamespaceTest.expect | 2 +- tests/TemporaryHandlerTest.expect | 2 +- tests/p0315_4Test.expect | 2 +- tests/p0315_6Test.expect | 4 +- 42 files changed, 100 insertions(+), 85 deletions(-) create mode 100644 tests/Issue593.cpp create mode 100644 tests/Issue593.expect diff --git a/.clang-format b/.clang-format index 563c3d10..d1bbfe4f 100644 --- a/.clang-format +++ b/.clang-format @@ -56,7 +56,6 @@ ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] # Priority: 3 # - Regex: '.*' # Priority: 1 -SortIncludes: false IncludeCategories: - Regex: '^<.*\.h>' Priority: 1 diff --git a/CodeGenerator.cpp b/CodeGenerator.cpp index b376ba6a..ec175c46 100644 --- a/CodeGenerator.cpp +++ b/CodeGenerator.cpp @@ -1768,8 +1768,9 @@ void CodeGenerator::InsertArg(const ImplicitCastExpr* stmt) case CastKind::CK_PointerToIntegral: [[fallthrough]]; case CastKind::CK_BitCast: [[fallthrough]]; case CastKind::CK_UncheckedDerivedToBase: [[fallthrough]]; - case CastKind::CK_ToUnion: [[fallthrough]]; - case CastKind::CK_UserDefinedConversion: [[fallthrough]]; + case CastKind::CK_ToUnion: + [[fallthrough]]; + // case CastKind::CK_UserDefinedConversion: [[fallthrough]]; case CastKind::CK_AtomicToNonAtomic: [[fallthrough]]; case CastKind::CK_DerivedToBase: [[fallthrough]]; case CastKind::CK_FloatingCast: [[fallthrough]]; diff --git a/tests/CharLiteralTest.expect b/tests/CharLiteralTest.expect index 7e80e36d..a6f4f37e 100644 --- a/tests/CharLiteralTest.expect +++ b/tests/CharLiteralTest.expect @@ -89,25 +89,25 @@ class Test inline void Apply() { Foo * data = this->mData; - data[static_cast(this->GetLength().operator int()) + 1].operator=('\0'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\n'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\\'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\''); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\a'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\b'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\f'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\r'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\t'); - data[static_cast(this->GetLength().operator int()) + 1].operator=('\v'); - data[static_cast(this->GetLength().operator int()) + 1].operator=(static_cast(L'\n')); - data[static_cast(this->GetLength().operator int()) + 1].operator=(u8'\n'); - data[static_cast(this->GetLength().operator int()) + 1].operator=(static_cast(u'\n')); - data[static_cast(this->GetLength().operator int()) + 1].operator=(static_cast(U'\n')); - data[static_cast(this->GetLength().operator int()) + 1].operator=(3U); - data[static_cast(this->GetLength().operator int()) + 1].operator=(3UL); - data[static_cast(this->GetLength().operator int()) + 1].operator=(3ULL); - data[static_cast(this->GetLength().operator int()) + 1].operator=(3LL); - data[static_cast(this->GetLength().operator int()) + 1].operator=(3L); + data[this->GetLength().operator int() + 1].operator=('\0'); + data[this->GetLength().operator int() + 1].operator=('\n'); + data[this->GetLength().operator int() + 1].operator=('\\'); + data[this->GetLength().operator int() + 1].operator=('\''); + data[this->GetLength().operator int() + 1].operator=('\a'); + data[this->GetLength().operator int() + 1].operator=('\b'); + data[this->GetLength().operator int() + 1].operator=('\f'); + data[this->GetLength().operator int() + 1].operator=('\r'); + data[this->GetLength().operator int() + 1].operator=('\t'); + data[this->GetLength().operator int() + 1].operator=('\v'); + data[this->GetLength().operator int() + 1].operator=(static_cast(L'\n')); + data[this->GetLength().operator int() + 1].operator=(u8'\n'); + data[this->GetLength().operator int() + 1].operator=(static_cast(u'\n')); + data[this->GetLength().operator int() + 1].operator=(static_cast(U'\n')); + data[this->GetLength().operator int() + 1].operator=(3U); + data[this->GetLength().operator int() + 1].operator=(3UL); + data[this->GetLength().operator int() + 1].operator=(3ULL); + data[this->GetLength().operator int() + 1].operator=(3LL); + data[this->GetLength().operator int() + 1].operator=(3L); } inline Foo GetLength() const diff --git a/tests/Class2Test.expect b/tests/Class2Test.expect index 602366b1..8b1636f8 100644 --- a/tests/Class2Test.expect +++ b/tests/Class2Test.expect @@ -33,7 +33,7 @@ class Test { Test tmp = Test(*this) /* NRVO variable */; this->operator++(); - return Test(static_cast(static_cast(tmp).operator int())); + return Test(static_cast(tmp).operator int()); } inline Test & operator+=(const Test & rhs) @@ -72,7 +72,7 @@ int main() s.count.operator++(0); Test t = Test(); char * raw = reinterpret_cast(&s + 1); - Test * p = reinterpret_cast(&raw[static_cast(s.count.operator int())]); + Test * p = reinterpret_cast(&raw[s.count.operator int()]); (*p).operator=((t)); (*p).operator=(s2.count); s.count.operator+=(Test(static_cast(sizeof(p)))); diff --git a/tests/ClassTest.expect b/tests/ClassTest.expect index e477ac31..28cc7a5b 100644 --- a/tests/ClassTest.expect +++ b/tests/ClassTest.expect @@ -28,7 +28,7 @@ class Test { Test tmp = Test(*this) /* NRVO variable */; this->operator++(); - return Test(static_cast(static_cast(tmp).operator int())); + return Test(static_cast(tmp).operator int()); } inline Test & operator+=(const Test & rhs) @@ -55,7 +55,7 @@ int main() Test t = Test(2); t.operator=(Test(3 * 2)); Test tt = Test(4); - t.operator+=(Test(static_cast(tt.operator int()) * 2)); + t.operator+=(Test(tt.operator int() * 2)); return 0; } diff --git a/tests/ConversionDeclTest.expect b/tests/ConversionDeclTest.expect index aa598104..4a2a0d7a 100644 --- a/tests/ConversionDeclTest.expect +++ b/tests/ConversionDeclTest.expect @@ -39,7 +39,7 @@ namespace test int main() { test::coroutine_handle a = {}; - test::coroutine_handle b = static_cast>(a.operator test::coroutine_handle()); + test::coroutine_handle b = a.operator test::coroutine_handle(); return 0; } diff --git a/tests/CoroutinesCoReturnPlusTest.expect b/tests/CoroutinesCoReturnPlusTest.expect index 9964dee1..d769508b 100644 --- a/tests/CoroutinesCoReturnPlusTest.expect +++ b/tests/CoroutinesCoReturnPlusTest.expect @@ -70,7 +70,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineAllocFailureTest.expect b/tests/EduCoroutineAllocFailureTest.expect index 2170f4ab..02f476ee 100644 --- a/tests/EduCoroutineAllocFailureTest.expect +++ b/tests/EduCoroutineAllocFailureTest.expect @@ -124,7 +124,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineBinaryExprTest.expect b/tests/EduCoroutineBinaryExprTest.expect index df6f8d35..94baca7c 100644 --- a/tests/EduCoroutineBinaryExprTest.expect +++ b/tests/EduCoroutineBinaryExprTest.expect @@ -55,7 +55,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineCaptureConstTest.expect b/tests/EduCoroutineCaptureConstTest.expect index dc4313d2..0b5fad3e 100644 --- a/tests/EduCoroutineCaptureConstTest.expect +++ b/tests/EduCoroutineCaptureConstTest.expect @@ -55,7 +55,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineCaptureThisTest.expect b/tests/EduCoroutineCaptureThisTest.expect index 63fad4d8..2c95903a 100644 --- a/tests/EduCoroutineCaptureThisTest.expect +++ b/tests/EduCoroutineCaptureThisTest.expect @@ -54,7 +54,7 @@ struct my_resumable inline ~my_resumable() noexcept { - if(static_cast(this->m_handle.operator bool())) { + if(this->m_handle.operator bool()) { this->m_handle.destroy(); } diff --git a/tests/EduCoroutineCoreturnWithCoawaitTest.expect b/tests/EduCoroutineCoreturnWithCoawaitTest.expect index 1c495f03..567341aa 100644 --- a/tests/EduCoroutineCoreturnWithCoawaitTest.expect +++ b/tests/EduCoroutineCoreturnWithCoawaitTest.expect @@ -76,7 +76,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineCustomYieldTypeTest.expect b/tests/EduCoroutineCustomYieldTypeTest.expect index e008ad82..5a52db0d 100644 --- a/tests/EduCoroutineCustomYieldTypeTest.expect +++ b/tests/EduCoroutineCustomYieldTypeTest.expect @@ -110,7 +110,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineExprTest.expect b/tests/EduCoroutineExprTest.expect index 3c47b754..3fec01d8 100644 --- a/tests/EduCoroutineExprTest.expect +++ b/tests/EduCoroutineExprTest.expect @@ -45,7 +45,7 @@ struct task if(previous) { return previous; } else { - return static_cast>(std::noop_coroutine().operator std::coroutine_handle()); + return std::noop_coroutine().operator std::coroutine_handle(); } } @@ -154,10 +154,10 @@ struct task { { std::coroutine_handle previous = std::coroutine_handle(h.promise().previous); - if(static_cast(previous.operator bool())) { + if(previous.operator bool()) { return std::coroutine_handle(static_cast &&>(previous)); } else { - return static_cast>(std::noop_coroutine().operator std::coroutine_handle()); + return std::noop_coroutine().operator std::coroutine_handle(); } } diff --git a/tests/EduCoroutineSimpleTest.expect b/tests/EduCoroutineSimpleTest.expect index b1d6abc2..e5834b50 100644 --- a/tests/EduCoroutineSimpleTest.expect +++ b/tests/EduCoroutineSimpleTest.expect @@ -56,7 +56,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineSuspendNeverBoolTest.expect b/tests/EduCoroutineSuspendNeverBoolTest.expect index 70996849..2c766953 100644 --- a/tests/EduCoroutineSuspendNeverBoolTest.expect +++ b/tests/EduCoroutineSuspendNeverBoolTest.expect @@ -132,7 +132,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineSuspendNeverTest.expect b/tests/EduCoroutineSuspendNeverTest.expect index 8d90da4a..a3243168 100644 --- a/tests/EduCoroutineSuspendNeverTest.expect +++ b/tests/EduCoroutineSuspendNeverTest.expect @@ -114,7 +114,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineTemplateGeneratorTest.expect b/tests/EduCoroutineTemplateGeneratorTest.expect index f81d9f6f..8517052e 100644 --- a/tests/EduCoroutineTemplateGeneratorTest.expect +++ b/tests/EduCoroutineTemplateGeneratorTest.expect @@ -114,7 +114,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineVoidTest.expect b/tests/EduCoroutineVoidTest.expect index a15a11f5..9f7a2e15 100644 --- a/tests/EduCoroutineVoidTest.expect +++ b/tests/EduCoroutineVoidTest.expect @@ -116,7 +116,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineWithDtorTest.expect b/tests/EduCoroutineWithDtorTest.expect index ed8dd2a9..f34dc862 100644 --- a/tests/EduCoroutineWithDtorTest.expect +++ b/tests/EduCoroutineWithDtorTest.expect @@ -133,7 +133,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineWithExceptionHandlerTest.expect b/tests/EduCoroutineWithExceptionHandlerTest.expect index 44f09243..3e51af0b 100644 --- a/tests/EduCoroutineWithExceptionHandlerTest.expect +++ b/tests/EduCoroutineWithExceptionHandlerTest.expect @@ -132,7 +132,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/EduCoroutineWithLambdaTest.expect b/tests/EduCoroutineWithLambdaTest.expect index 2e177dbe..7d5a10f2 100644 --- a/tests/EduCoroutineWithLambdaTest.expect +++ b/tests/EduCoroutineWithLambdaTest.expect @@ -56,7 +56,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/IfSwitchInitHandler5Test.expect b/tests/IfSwitchInitHandler5Test.expect index 0c99bbcc..ba95d8e7 100644 --- a/tests/IfSwitchInitHandler5Test.expect +++ b/tests/IfSwitchInitHandler5Test.expect @@ -7,7 +7,7 @@ int main() std::weak_ptr weakPtr = std::weak_ptr(sharedPtr, 0); { std::shared_ptr sharedPtr1 = weakPtr.lock(); - if(static_cast(sharedPtr1.operator bool())) { + if(sharedPtr1.operator bool()) { std::operator<<(std::cout, "*sharedPtr: ").operator<<(sharedPtr.operator*()).operator<<(std::endl); } else { } diff --git a/tests/Issue324.expect b/tests/Issue324.expect index 92999426..f9cd1d97 100644 --- a/tests/Issue324.expect +++ b/tests/Issue324.expect @@ -22,6 +22,6 @@ Str globalString = Str("test"); const char * getString(bool empty) { - return static_cast((empty ? Str("") : Str(globalString)).operator const char *()); + return (empty ? Str("") : Str(globalString)).operator const char *(); } diff --git a/tests/Issue467.expect b/tests/Issue467.expect index 9d295784..c8a06066 100644 --- a/tests/Issue467.expect +++ b/tests/Issue467.expect @@ -32,8 +32,8 @@ int main() l.operator()(); l.operator()(); l.operator()(); - (+static_cast(l.operator __lambda_5_14::retType_5_14()))(); - (+static_cast(l.operator __lambda_5_14::retType_5_14()))(); + (+l.operator __lambda_5_14::retType_5_14())(); + (+l.operator __lambda_5_14::retType_5_14())(); return 0; } diff --git a/tests/Issue491.expect b/tests/Issue491.expect index 233e97d2..3d0fea85 100644 --- a/tests/Issue491.expect +++ b/tests/Issue491.expect @@ -39,5 +39,5 @@ class __lambda_1_10 }; -__lambda_1_10 x = __lambda_1_10{+static_cast(__lambda_1_16{}.operator __lambda_1_16::retType_1_16())}; +__lambda_1_10 x = __lambda_1_10{+__lambda_1_16{}.operator __lambda_1_16::retType_1_16()}; diff --git a/tests/Issue518.expect b/tests/Issue518.expect index dcbb5ea9..bf999d93 100644 --- a/tests/Issue518.expect +++ b/tests/Issue518.expect @@ -45,7 +45,7 @@ struct task if(previous) { return previous; } else { - return static_cast>(std::noop_coroutine().operator std::coroutine_handle()); + return std::noop_coroutine().operator std::coroutine_handle(); } } @@ -154,10 +154,10 @@ struct task { { std::coroutine_handle previous = std::coroutine_handle(h.promise().previous); - if(static_cast(previous.operator bool())) { + if(previous.operator bool()) { return std::coroutine_handle(static_cast &&>(previous)); } else { - return static_cast>(std::noop_coroutine().operator std::coroutine_handle()); + return std::noop_coroutine().operator std::coroutine_handle(); } } diff --git a/tests/Issue536.expect b/tests/Issue536.expect index a2fad47b..657def0c 100644 --- a/tests/Issue536.expect +++ b/tests/Issue536.expect @@ -54,7 +54,7 @@ struct my_resumable inline ~my_resumable() noexcept { - if(static_cast(this->m_handle.operator bool())) { + if(this->m_handle.operator bool()) { this->m_handle.destroy(); } diff --git a/tests/Issue536_2.expect b/tests/Issue536_2.expect index b35fe2da..a1bec908 100644 --- a/tests/Issue536_2.expect +++ b/tests/Issue536_2.expect @@ -54,7 +54,7 @@ struct my_resumable inline ~my_resumable() noexcept { - if(static_cast(this->m_handle.operator bool())) { + if(this->m_handle.operator bool()) { this->m_handle.destroy(); } diff --git a/tests/Issue593.cpp b/tests/Issue593.cpp new file mode 100644 index 00000000..2f8466d0 --- /dev/null +++ b/tests/Issue593.cpp @@ -0,0 +1,4 @@ +struct A { operator int&(); }; + +int& ir = A(); + diff --git a/tests/Issue593.expect b/tests/Issue593.expect new file mode 100644 index 00000000..5a088377 --- /dev/null +++ b/tests/Issue593.expect @@ -0,0 +1,11 @@ +struct A +{ + operator int & (); + +}; + + + +int & ir = A().operator int &(); + + diff --git a/tests/Issue92.expect b/tests/Issue92.expect index aafd3e66..3ca4a70e 100644 --- a/tests/Issue92.expect +++ b/tests/Issue92.expect @@ -220,7 +220,7 @@ struct generator inline ~generator() noexcept { - if(static_cast(this->p.operator bool())) { + if(this->p.operator bool()) { this->p.destroy(); } diff --git a/tests/LambdaHandler2Test.expect b/tests/LambdaHandler2Test.expect index e9b644db..cda67bd7 100644 --- a/tests/LambdaHandler2Test.expect +++ b/tests/LambdaHandler2Test.expect @@ -25,7 +25,7 @@ int main() }; using FuncPtr_8 = int (*)(int, char); - FuncPtr_8 fp = static_cast(__lambda_8_26{}.operator __lambda_8_26::retType_8_26()); + FuncPtr_8 fp = __lambda_8_26{}.operator __lambda_8_26::retType_8_26(); return 0; } diff --git a/tests/LambdaHandlerCaptureLessTest.cerr b/tests/LambdaHandlerCaptureLessTest.cerr index dd3361bd..5214f2c7 100644 --- a/tests/LambdaHandlerCaptureLessTest.cerr +++ b/tests/LambdaHandlerCaptureLessTest.cerr @@ -4,7 +4,7 @@ .tmp.cpp:35:5: error: templates cannot be declared inside of a local class 35 | template | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.tmp.cpp:53:90: error: no type named 'retType_4_28' in '__lambda_4_28' - 53 | FuncPtr_4 fp = static_cast(__lambda_4_28{}.operator __lambda_4_28::retType_4_28()); - | ~~~~~~~~~~~~~~~^ +.tmp.cpp:53:58: error: no type named 'retType_4_28' in '__lambda_4_28' + 53 | FuncPtr_4 fp = __lambda_4_28{}.operator __lambda_4_28::retType_4_28(); + | ~~~~~~~~~~~~~~~^ 3 errors generated. diff --git a/tests/LambdaHandlerCaptureLessTest.expect b/tests/LambdaHandlerCaptureLessTest.expect index cf7c3acd..52203b29 100644 --- a/tests/LambdaHandlerCaptureLessTest.expect +++ b/tests/LambdaHandlerCaptureLessTest.expect @@ -50,7 +50,7 @@ int main() }; using FuncPtr_4 = int (*)(int, char); - FuncPtr_4 fp = static_cast(__lambda_4_28{}.operator __lambda_4_28::retType_4_28()); + FuncPtr_4 fp = __lambda_4_28{}.operator __lambda_4_28::retType_4_28(); return 0; } diff --git a/tests/LambdaWithFunctionPointerTest.expect b/tests/LambdaWithFunctionPointerTest.expect index 419a7824..7064a577 100644 --- a/tests/LambdaWithFunctionPointerTest.expect +++ b/tests/LambdaWithFunctionPointerTest.expect @@ -80,6 +80,6 @@ class __lambda_5_10 __lambda_5_10 C = __lambda_5_10{}; -/* PASSED: static_assert(Fwd.operator()(static_cast(C.operator __lambda_5_10::retType_5_10()), 3) == 3); */ +/* PASSED: static_assert(Fwd.operator()(C.operator __lambda_5_10::retType_5_10(), 3) == 3); */ diff --git a/tests/LambdaWithStaticInvokerTest.cerr b/tests/LambdaWithStaticInvokerTest.cerr index 88000911..b9f4ecc0 100644 --- a/tests/LambdaWithStaticInvokerTest.cerr +++ b/tests/LambdaWithStaticInvokerTest.cerr @@ -1,21 +1,21 @@ -.tmp.cpp:133:62: error: no type named 'retType_25_16' in '__lambda_25_16'; did you mean '__lambda_5_14::retType_5_14'? - 133 | FuncPtr_29 fp = static_cast(glambda.operator __lambda_25_16::retType_25_16()); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - | __lambda_5_14::retType_5_14 +.tmp.cpp:133:36: error: no type named 'retType_25_16' in '__lambda_25_16'; did you mean '__lambda_5_14::retType_5_14'? + 133 | FuncPtr_29 fp = glambda.operator __lambda_25_16::retType_25_16(); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | __lambda_5_14::retType_5_14 .tmp.cpp:15:11: note: '__lambda_5_14::retType_5_14' declared here 15 | using retType_5_14 = int (*)(); | ^ -.tmp.cpp:133:53: error: no member named 'operator int (*)()' in '__lambda_25_16' - 133 | FuncPtr_29 fp = static_cast(glambda.operator __lambda_25_16::retType_25_16()); - | ~~~~~~~ ^ -.tmp.cpp:206:78: error: no type named 'retType_32_27' in '__lambda_32_27'; did you mean '__lambda_14_20::retType_14_20'? - 206 | FuncPtr_41 fp = static_cast(lWithParamsAndNTTP.operator __lambda_32_27::retType_32_27()); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - | __lambda_14_20::retType_14_20 +.tmp.cpp:133:27: error: no member named 'operator int (*)()' in '__lambda_25_16' + 133 | FuncPtr_29 fp = glambda.operator __lambda_25_16::retType_25_16(); + | ~~~~~~~ ^ +.tmp.cpp:206:47: error: no type named 'retType_32_27' in '__lambda_32_27'; did you mean '__lambda_14_20::retType_14_20'? + 206 | FuncPtr_41 fp = lWithParamsAndNTTP.operator __lambda_32_27::retType_32_27(); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | __lambda_14_20::retType_14_20 .tmp.cpp:49:9: note: '__lambda_14_20::retType_14_20' declared here 49 | using retType_14_20 = int (*)(int, int); | ^ -.tmp.cpp:206:69: error: no member named 'operator int (*)(int, int)' in '__lambda_32_27' - 206 | FuncPtr_41 fp = static_cast(lWithParamsAndNTTP.operator __lambda_32_27::retType_32_27()); - | ~~~~~~~~~~~~~~~~~~ ^ +.tmp.cpp:206:38: error: no member named 'operator int (*)(int, int)' in '__lambda_32_27' + 206 | FuncPtr_41 fp = lWithParamsAndNTTP.operator __lambda_32_27::retType_32_27(); + | ~~~~~~~~~~~~~~~~~~ ^ 4 errors generated. diff --git a/tests/LambdaWithStaticInvokerTest.expect b/tests/LambdaWithStaticInvokerTest.expect index 8ee852a6..34f5eb90 100644 --- a/tests/LambdaWithStaticInvokerTest.expect +++ b/tests/LambdaWithStaticInvokerTest.expect @@ -32,7 +32,7 @@ void NoParams() __lambda_5_14 l = __lambda_5_14{}; bool res = (1 == l.operator()()); - bool res2 = (2 == (+static_cast(l.operator __lambda_5_14::retType_5_14()))()); + bool res2 = (2 == (+l.operator __lambda_5_14::retType_5_14())()); } @@ -70,7 +70,7 @@ __lambda_14_20 lWithParams = __lambda_14_20{}; void WithParams() { bool res = (6 == lWithParams.operator()(2, 3)); - bool res2 = (7 == (+static_cast(lWithParams.operator __lambda_14_20::retType_14_20()))(2, 3)); + bool res2 = (7 == (+lWithParams.operator __lambda_14_20::retType_14_20())(2, 3)); } @@ -130,7 +130,7 @@ __lambda_25_16 glambda = __lambda_25_16{}; void WithParamsGeneric() { using FuncPtr_29 = int (*)(int); - FuncPtr_29 fp = static_cast(glambda.operator __lambda_25_16::retType_25_16()); + FuncPtr_29 fp = glambda.operator __lambda_25_16::retType_25_16(); } @@ -203,7 +203,7 @@ void WithParamsAndNTTP() { int res = lWithParamsAndNTTP.operator()<1, 0>(2, 3); using FuncPtr_41 = int (*)(int, int); - FuncPtr_41 fp = static_cast(lWithParamsAndNTTP.operator __lambda_32_27::retType_32_27()); + FuncPtr_41 fp = lWithParamsAndNTTP.operator __lambda_32_27::retType_32_27(); } diff --git a/tests/StringViewNamespaceTest.expect b/tests/StringViewNamespaceTest.expect index 27add75d..fef14da7 100644 --- a/tests/StringViewNamespaceTest.expect +++ b/tests/StringViewNamespaceTest.expect @@ -5,7 +5,7 @@ int main() { std::basic_string, std::allocator > str = std::basic_string, std::allocator >("Some string"); - std::basic_string_view > strView = static_cast >>(str.operator std::basic_string_view >()); + std::basic_string_view > strView = str.operator std::basic_string_view >(); std::operator<<(std::operator<<(std::cout, "strView : "), std::basic_string_view >(strView)).operator<<(std::endl); return 0; } diff --git a/tests/TemporaryHandlerTest.expect b/tests/TemporaryHandlerTest.expect index 925c3dea..7097e797 100644 --- a/tests/TemporaryHandlerTest.expect +++ b/tests/TemporaryHandlerTest.expect @@ -42,7 +42,7 @@ void foo(B &) int main() { - foo(static_cast(static_cast(C()).operator A())); + foo(static_cast(C()).operator A()); return 0; } diff --git a/tests/p0315_4Test.expect b/tests/p0315_4Test.expect index 458be941..717e98c6 100644 --- a/tests/p0315_4Test.expect +++ b/tests/p0315_4Test.expect @@ -56,7 +56,7 @@ struct Test }; - void (*fp)() = (+static_cast(__lambda_7_29{}.operator __lambda_7_29::retType_7_29())); + void (*fp)() = (+__lambda_7_29{}.operator __lambda_7_29::retType_7_29()); }; diff --git a/tests/p0315_6Test.expect b/tests/p0315_6Test.expect index 829d055b..78c6a397 100644 --- a/tests/p0315_6Test.expect +++ b/tests/p0315_6Test.expect @@ -26,7 +26,7 @@ class __lambda_3_47 }; using FuncPtr_3 = auto (*)() -> void; -FuncPtr_3 a = (+static_cast(__lambda_3_47{}.operator __lambda_3_47::retType_3_47())); +FuncPtr_3 a = (+__lambda_3_47{}.operator __lambda_3_47::retType_3_47()); @@ -56,5 +56,5 @@ class __lambda_5_16 }; using FuncPtr_5 = void (*)(); -FuncPtr_5 fp = static_cast(__lambda_5_16{}.operator __lambda_5_16::retType_5_16()); +FuncPtr_5 fp = __lambda_5_16{}.operator __lambda_5_16::retType_5_16();