File tree Expand file tree Collapse file tree 2 files changed +31
-14
lines changed
test/CXX/dcl.decl/dcl.init/dcl.init.general Expand file tree Collapse file tree 2 files changed +31
-14
lines changed Original file line number Diff line number Diff line change @@ -6714,7 +6714,8 @@ void InitializationSequence::InitializeFrom(Sema &S,
6714
6714
OverloadCandidateSet::iterator Best;
6715
6715
OverloadingResult OR = getFailedCandidateSet ().BestViableFunction (
6716
6716
S, Kind.getLocation (), Best);
6717
- if (OR != OverloadingResult::OR_Deleted) {
6717
+ if (OR != OverloadingResult::OR_Deleted &&
6718
+ Kind.getKind () == InitializationKind::IK_Direct) {
6718
6719
// C++20 [dcl.init] 17.6.2.2:
6719
6720
// - Otherwise, if no constructor is viable, the destination type is
6720
6721
// an
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2
2
3
- // If the initializer is (), the object is value-initialized.
4
-
5
- // expected-no-diagnostics
6
3
namespace GH69890 {
7
- struct A {
8
- constexpr A () {}
9
- int x;
10
- };
4
+ // If the initializer is (), the object is value-initialized.
5
+ struct A {
6
+ constexpr A () {}
7
+ int x;
8
+ };
9
+
10
+ struct B : A {
11
+ int y;
12
+ };
13
+
14
+ static_assert (B().x == 0 );
15
+ static_assert (B().y == 0 );
16
+ } // namespace GH69890
17
+
18
+ namespace P0960R3 {
19
+ struct A { // expected-note 9 {{candidate constructor}}
20
+ int i;
21
+ operator int () volatile;
22
+ };
23
+
24
+ volatile A va;
25
+ A a = va; // expected-error {{no matching constructor for initialization of 'A'}}
11
26
12
- struct B : A {
13
- int y;
14
- };
27
+ A f () {
28
+ return va; // expected-error {{no matching constructor for initialization of 'A'}}
29
+ }
15
30
16
- static_assert (B().x == 0 );
17
- static_assert (B().y == 0 );
18
- }
31
+ int g (A); // expected-note {{passing argument to parameter here}}
32
+ int g (auto &&);
33
+ int i = g(va); // expected-error {{no matching constructor for initialization of 'A'}}
34
+ } // namespace P0960R3
You can’t perform that action at this time.
0 commit comments