Skip to content

Assertion `oldBlock->capturesCXXThis() == blockScope->isCXXThisCaptured() #24924

Open
@llvmbot

Description

@llvmbot
Bugzilla Link 24550
Version 3.7
OS Linux
Attachments run script
Reporter LLVM Bugzilla Contributor

Extended Description

Compiling the code below with -fblocks causes clang to trigger it's own assertion. The run script is attached as requested, the preprocessed source
code looks identical to the code below.

[ --- code --- ]

typedef void (^Block)();

void invoke_block (Block block);

// --- a class

class A
{
public:
int f () { return 0; }
};

// --- template base class ---

template
class Base
{
public:
T * t;

virtual void virtual_function () {}

};

// --- derive from template base class

template
class Derv : public Base
{
virtual void virtual_function ();
};

template
void Derv::virtual_function ()
{
invoke_block (^() {
int i = Base::t->f ();
});
}

int main(int argc, char **argv)
{
Derv d;

return 0;

}

[ --- end of code --- ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]objective-c++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions