Skip to content

Segfault with performance-unnecessary-value-param check #45855

Closed
@varqox

Description

@varqox
Bugzilla Link 46510
Version unspecified
OS Linux
CC @EugeneZelenko,@fberger,@irishrover

Extended Description

Running
clang-tidy -checks='performance-unnecessary-value-param' bug.cc
on the following code results in a segfault:

struct Foo {
Foo(const Foo&) {}
};

template
bool recur(unsigned x, T&& val) {
if (x == 0) {
return false;
}
return recur(x / 2, val);
}

void bar(Foo entry) {
recur(0, entry);
}

Both clang 10.0.0 and current trunk (clang 11) segfault (see https://godbolt.org/z/gzVMqr).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang-tidyconfirmedVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions