Skip to content

Most vexing parse only reported on local variables #9467

@llvmbot

Description

@llvmbot
Bugzilla Link 9095
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @akyrtzi,@DougGregor,@linzj

Extended Description

In

struct foo {
};

struct bar {
  bar(foo x);
};

bar y(foo());

int main(void) {
  bar x(foo());
  return 0;
}

clang reports:

test.cc:11:8: warning: parentheses were disambiguated as a function declarator
  bar x(foo());
       ^~~~~~~

but no warning is printed for y.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions