summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
diff options
context:
space:
mode:
authorAlejandro Álvarez Ayllón <alejandro.alvarez@sonarsource.com>2024-09-18 10:11:03 +0200
committerGitHub <noreply@github.com>2024-09-18 10:11:03 +0200
commit0dd56858fe188419182a57d0e03c8cd0aa693867 (patch)
tree614eda39c8f9f8df616a4641e2c616d393f3942c /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
parent94a98cf5dc9317ba8b01c31443ca563808323d11 (diff)
[clang][Sema] Fix assertion in `tryDiagnoseOverloadedCast` (#108021)
Fixed an assertion failure in debug mode, and potential crashes in release mode, when diagnosing a failed cast caused indirectly by a failed implicit conversion to the type of the constructor parameter. For instance ``` template<typename> struct StringTrait {}; template< int N > struct StringTrait< const char[ N ] > { typedef char CharType; static const MissingIntT length = N - 1; }; class String { public: template <typename T> String(T& str, typename StringTrait<T>::CharType = 0); }; class Exception { public: Exception(String const&); }; void foo() { throw Exception("some error"); } ``` `Exception(String const&)` is a matching constructor for `Exception` from a `const char*`, via an implicit conversion to `String`. However, the instantiation of the `String` constructor will fail because of the missing type `MissingIntT` inside the specialization of `StringTrait`. When trying to emit a diagnosis, `tryDiagnoseOverloadedCast` expects not to have a matching constructor, but there is; it just could not be instantiated.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp')
0 files changed, 0 insertions, 0 deletions