Issue |
156539
|
Summary |
[clang] Clang incorrectly accepts reference initialized from a prvalue using an explicit constructor
|
Labels |
|
Assignees |
|
Reporter |
shahms
|
[[decl.init.list]](https://eel.is/c++draft/dcl.init#list-3.10) states:
> Otherwise, if T is a reference type, a prvalue is generated[.](https://eel.is/c++draft/dcl.init#list-3.10.sentence-1) The prvalue initializes its result object by *copy-list-initialization* from the initializer list[.](https://eel.is/c++draft/dcl.init#list-3.10.sentence-2) The prvalue is then used to direct-initialize the reference
And then subsequently includes the example:
```
struct A { } a;
struct B { explicit B(const A&); };
const B& b2{a}; // error: cannot copy-list-initialize B temporary from A
```
Clang happily compiles that example, despite the standard's prohibition.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs