-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Description
Bugzilla Link | 47357 |
Version | trunk |
OS | Linux |
Reporter | LLVM Bugzilla Contributor |
CC | @dwblaikie,@JohelEGP,@kirshamir,@zygoloid |
Extended Description
Clang++ rejects the following code, while g++ accepts.
$ cat s.cpp
struct A
{
int a;
};
void f()
{
auto y = new A(1);
}
$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git ab46273)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ g++ -c -std=c++2a s.cpp
success.
$ clang++ -c std=c++2a s.cpp
s.cpp:8:16: error: no matching constructor for initialization of 'A'
auto y = new A(1);
^ ~
s.cpp:1:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const A' for 1st argument
struct A
^
s.cpp:1:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'A' for 1st argument
struct A
^
s.cpp:1:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
1 error generated.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status