llvm / llvm/llvm-project

Parenthesized members are incorrectly recognized as constructors

Open
#174,366 3 comments 0 reactions 0 assignees View on GitHub
clang:frontend confirmed diverges-from:edg diverges-from:gcc diverges-from:msvc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The following program demonstrates the issue:
```cpp
struct S{
static S(foo);
};
int main(){}
```
`foo` isn't a valid _parameter-declaration-clause_, so this shouldn't be considered a constructor . GCC, MSVC, and EDG accept this. Clang correctly parses this with another set of parentheses, e.g. `static S((foo));`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.