Skip to content

[clang] NRVO used in C mode #100902

@TedLyngmo

Description

@TedLyngmo

This C program exits with 1 even though it should exit with 0. To the best of my knowledge, NRVO is not allowed in C:

typedef struct {
    int i, j;
    double a, b;
} S;

int result;

S test(S* q) {
    S s = {0, 0, 0, 0};
    result = &s == q;
    return s;
}

int main(void)
{
  S t = test(&t);
  return result;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    cclang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions