Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.11
-
None
-
Qt 6.11.0 clang 21.0.0git Host: Linux (WSL2) Target: x86_64-apple-darwin24.5 Build system: CMake + Ninja
-
-
macOS
Description
Error Details
Compiler Crash
clang++: /home/mccakit/llvm-project/clang/lib/Sema/TreeTransform.h:17056:
clang::ExprResult clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformBlockExpr(clang::BlockExpr *)
[Derived = (anonymous namespace)::TemplateInstantiator]:
Assertion `(!blockScope->isCXXThisCaptured() || oldBlock->capturesCXXThis()) &&
"this pointer isn't captured in the old block"' failed.
Problematic Code
Template Definition
template<typename Style>
class QMacApperanceStyle : public Style
{
public:
void drawPrimitive(typename Style::PrimitiveElement pe, const QStyleOption *opt, QPainter *p
OPTIONAL_WIDGET_ARGUMENT) const override
{
[NSApp.effectiveAppearance performAsCurrentDrawingAppearance:^
];
}
// ... similar methods for drawControl and drawComplexControl
};
Instantiation Site
QMacStyle *QMacStyle::create()
{ return new QMacApperanceStyle<QMacStyle>; // <- Causes compiler crash }Proposed Solutions
Option 1: Fix Template Capture
Modify the template to explicitly handle this capture:
void drawPrimitive(typename Style::PrimitiveElement pe, const QStyleOption *opt, QPainter *p
OPTIONAL_WIDGET_ARGUMENT) const override
{
const auto* self = this;
[NSApp.effectiveAppearance performAsCurrentDrawingAppearance:^
];
}