Skip to content

Constructing, destructing and returning a value of arbitrary type T causes static assertion failure inside LLVM's frontend #115658

Closed as duplicate of#53741
@TymianekPL

Description

@TymianekPL

Program: x86-64 clang 19.1.0 (assertions)
Example: Compiler Explorer
Log (same output inside the CE link above): clang-log.txt
Given the code:

void nop(void) noexcept
{
    typedef int T;
    return T{}.~T();
}

LLVM frontend crashes with assertion failure:

clang++: /root/llvm-project/clang/lib/AST/ExprConstant.cpp:10704: bool EvaluateTemporary(const clang::Expr*, {anonymous}::LValue&, {anonymous}::EvalInfo&): Assertion `E->isPRValue() && E->getType()->isRecordType()' failed.

Removing return keyword and leaving T{}.~T(); compiles successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:codegenIR generation bugs: mangling, exceptions, etc.confirmedVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]duplicateResolved as duplicate

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions